Reading MBS AVFoundationsettings dictionary


I’m trying to read the settings dictionary for the AVaudioplayer to get the sample rate, file type etc.

I have this in a labels’s open event and get a “This item does not exist” error for AVSampleRateKey.

  dim d as Dictionary = p.settings
  if d.HasKey(AVSampleRateKey) then
  End if

This may not be helped by the fact that I’ve not used dictionaries before!

[code] dim s as Dictionary = player.settings

dim rate as integer = s.Value(AVFoundationMBS.AVSampleRateKey)

MsgBox str(rate)[/code]

For me, it works. Not sure what you do.

Perfect Christian - that works now.

Thanks for the quick reply (and on a Sunday too)!

All good now but AVEncoderBitRateKey always returns zero (tried with mp3, wav and aif)?

This is a setting for AudioRecorder class, not for player.