Platforms to show: All Mac Windows Linux Cross-Platform
Back to AVAudioPlayerMBS class.
AVAudioPlayerMBS.currentDevice as String
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
property | AVFoundation | MBS AVFoundation Plugin | 18.4 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop, Console & Web |
Available on MacOS 10.13 or newer.
Settable in v20.0 or newer.
(Read and Write property)
AVAudioPlayerMBS.currentTime as Double
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
property | AVFoundation | MBS AVFoundation Plugin | 13.2 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
If the sound is playing, currentTime is the offset of the current playback position, measured in seconds from the start of the sound. If the sound is not playing, currentTime is the offset of where playing starts upon calling the play method, measured in seconds from the start of the sound.
By setting this property you can seek to a specific point in a sound file or implement audio fast-forward and rewind functions.
(Read and Write property)
AVAudioPlayerMBS.data as MemoryBlock
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
property | AVFoundation | MBS AVFoundation Plugin | 13.2 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
Returns nil if the audio player has no data (that is, if it was not initialized with an Memoryblock).
(Read only property)
AVAudioPlayerMBS.deviceCurrentTime as Double
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
property | AVFoundation | MBS AVFoundation Plugin | 13.2 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
The value of this property increases monotonically while an audio player is playing or paused.
If more than one audio player is connected to the audio output device, device time continues incrementing as long as at least one of the players is playing or paused.
If the audio output device has no connected audio players that are either playing or paused, device time reverts to 0.
Use this property to indicate "now" when calling the playAtTime instance method. By configuring multiple audio players to play at a specified offset from deviceCurrentTime, you can perform precise synchronization—as described in the discussion for that method.
(Read only property)
AVAudioPlayerMBS.duration as Double
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
property | AVFoundation | MBS AVFoundation Plugin | 13.2 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
(Read only property)
AVAudioPlayerMBS.enableRate as boolean
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
property | AVFoundation | MBS AVFoundation Plugin | 14.0 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
To enable adjustable playback rate for an audio player, set this property to YES after you initialize the player and before you call the prepareToPlay instance method for the player.
Available in OS X v10.8 and later.
(Read and Write property)
Some examples using this property:
AVAudioPlayerMBS.Handle as Integer
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
property | AVFoundation | MBS AVFoundation Plugin | 13.2 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
(Read and Write property)
AVAudioPlayerMBS.isPlaying as boolean
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
property | AVFoundation | MBS AVFoundation Plugin | 13.2 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
To find out when playback has stopped, use the AVFoundationMBS.audioPlayerDidFinishPlaying event.
Important: Do not poll this property (that is, do not use it inside of a loop) in an attempt to discover when playback has stopped.
(Read only property)
AVAudioPlayerMBS.meteringEnabled as boolean
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
property | AVFoundation | MBS AVFoundation Plugin | 13.2 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
The default value for the meteringEnabled property is off (Boolean false). Before using metering for an audio player, you need to enable it by setting this property to true.
(Read and Write property)
AVAudioPlayerMBS.Name as String
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
property | AVFoundation | MBS AVFoundation Plugin | 18.3 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
This uses the URL to pull the display name if possible, so you can show it to user or identify the player when debugging.
(Read only property)
AVAudioPlayerMBS.numberOfChannels as Integer
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
property | AVFoundation | MBS AVFoundation Plugin | 13.2 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
(Read only property)
AVAudioPlayerMBS.numberOfLoops as Integer
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
property | AVFoundation | MBS AVFoundation Plugin | 13.2 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
A value of 0, which is the default, means to play the sound once. Set a positive integer value to specify the number of times to return to the start and play again. For example, specifying a value of 1 results in a total of two plays of the sound. Set any negative integer value to loop the sound indefinitely until you call the stop method.
(Read and Write property)
AVAudioPlayerMBS.pan as Double
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
property | AVFoundation | MBS AVFoundation Plugin | 13.2 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
By setting this property you can position a sound in the stereo field. A value of –1.0 is full left, 0.0 is center, and 1.0 is full right.
(Read and Write property)
AVAudioPlayerMBS.rate as Double
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
property | AVFoundation | MBS AVFoundation Plugin | 14.0 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
This property's default value of 1.0 provides normal playback rate. The available range is from 0.5 for half-speed playback through 2.0 for double-speed playback.
To set an audio player's playback rate, you must first enable rate adjustment as described in the enableRate property description.
Available in OS X v10.8 and later.
(Read and Write property)
AVAudioPlayerMBS.settings as Dictionary
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
property | AVFoundation | MBS AVFoundation Plugin | 13.2 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
An audio player's settings dictionary contains keys for the following information about the player's associated sound:
Channel layout (AVChannelLayoutKey)
Encoder bit rate (AVEncoderBitRateKey)
Audio data format (AVFormatIDKey)
Channel count (AVNumberOfChannelsKey)
Sample rate (AVSampleRateKey)
The settings keys are described in AV Foundation Audio Settings Constants.
(Read only property)
AVAudioPlayerMBS.URL as string
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
property | AVFoundation | MBS AVFoundation Plugin | 13.2 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
Returns "" if the audio player was not initialized with a URL.
(Read only property)
AVAudioPlayerMBS.volume as Double
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
property | AVFoundation | MBS AVFoundation Plugin | 13.2 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
(Read and Write property)
The items on this page are in the following plugins: MBS AVFoundation Plugin.