Playing Sound in tvOS with AVAudioPlayer in Xamarin
About the AVAudioPlayer
The AVAudioPlayer
is used to playback audio data from either memory or a file. Apple recommends using this class to play audio in your app unless you are doing network streaming or require low latency audio I/O.
You can use the AVAudioPlayer
to do the following:
- Play sounds of any duration with optional looping.
- Play multiple sounds at the same time with optional synchronization.
- Control volume, playback rate and stereo positioning for each sounds playing.
- Support features such as fast forward or rewind.
- Obtain playback level metering data.
AVAudioPlayer
supports sounds in any audio format provided by iOS, tvOS and OS X such as .aif
, .wav
or .mp3
.
Playing Sounds in tvOS
Because tvOS supports the same Audio Toolbox classes as iOS, please see our iOS Playing Sound with AVAudioPlayer documentation for the full details of playing audio in a Xamarin.tvOS app.