Platforms to show: All Mac Windows Linux Cross-Platform

Back to AVAudioPlayerMBS class.

AVAudioPlayerMBS.audioPlayerWithData(Data as MemoryBlock, byref error as NSErrorMBS) as AVAudioPlayerMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method AVFoundation MBS AVFoundation Plugin 14.4 ✅ Yes ❌ No ❌ No ✅ Yes All
Initializes and returns an audio player for playing a designated memory buffer.

data: A block of data containing a sound to play. The audio data must be in a format supported by Core Audio. For a list of supported formats, see "Using Audio" in Multimedia Programming Guide.
Error: Pass in the address of a nil-initialized NSError object. If an error occurs, upon return the NSError object describes the error. If you do not want error information, pass in NULL.

On success, you get an initialized AVAudioPlayer object. Else the handle property is 0 and the Error parameter contains a code that describes the problem.

See also:

AVAudioPlayerMBS.audioPlayerWithData(Data as MemoryBlock, fileTypeHintUtiString as string, byref error as NSErrorMBS) as AVAudioPlayerMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method AVFoundation MBS AVFoundation Plugin 14.4 ✅ Yes ❌ No ❌ No ✅ Yes All
Initializes and returns an audio player using the specified data and file type hint.

data: The data object containing the audio.
fileTypeHintUtiString: A UTI that is used as a file type hint. The supported UTIs are defined in File Format UTIs.
error: If an error occurs, upon return the NSError object describes the error.

The utiString file type hint tells the parser what kind of sound data to expect so that data that may possibly be corrupt, can be successfully parsed.

Available in OS X v10.9 and later, but plugin calls variant without filetypehint on older versins.

See also:

AVAudioPlayerMBS.audioPlayerWithData(Data as String, byref error as NSErrorMBS) as AVAudioPlayerMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method AVFoundation MBS AVFoundation Plugin 15.0 ✅ Yes ❌ No ❌ No ✅ Yes All
Initializes and returns an audio player for playing a designated memory buffer.

data: A block of data containing a sound to play. The audio data must be in a format supported by Core Audio. For a list of supported formats, see "Using Audio" in Multimedia Programming Guide.
Error: Pass in the address of a nil-initialized NSError object. If an error occurs, upon return the NSError object describes the error. If you do not want error information, pass in NULL.

On success, you get an initialized AVAudioPlayer object. Else the handle property is 0 and the Error parameter contains a code that describes the problem.

See also:

AVAudioPlayerMBS.audioPlayerWithData(Data as String, fileTypeHintUtiString as string, byref error as NSErrorMBS) as AVAudioPlayerMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method AVFoundation MBS AVFoundation Plugin 15.0 ✅ Yes ❌ No ❌ No ✅ Yes All
Initializes and returns an audio player using the specified data and file type hint.

data: The data object containing the audio.
fileTypeHintUtiString: A UTI that is used as a file type hint. The supported UTIs are defined in File Format UTIs.
error: If an error occurs, upon return the NSError object describes the error.

The utiString file type hint tells the parser what kind of sound data to expect so that data that may possibly be corrupt, can be successfully parsed.

Available in OS X v10.9 and later, but plugin calls variant without filetypehint on older versins.

See also:

AVAudioPlayerMBS.audioPlayerWithFile(File as folderitem, byref error as NSErrorMBS) as AVAudioPlayerMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method AVFoundation MBS AVFoundation Plugin 14.4 ✅ Yes ❌ No ❌ No ✅ Yes All
Initializes and returns an audio player for playing a designated sound file.
Example
dim f as FolderItem = SpecialFolder.Desktop.Child("test.mp3")
dim e as NSErrorMBS
dim u as AVAudioPlayerMBS.audioPlayerWithFile(f,e)
if e<>nil then
MsgBox e.localizedDescription
else
MsgBox str(u.duration)+" seconds"
end if

File: A folderitem identifying the sound file to play. The audio data must be in a format supported by Core Audio. For a list of supported formats, see "Using Audio" in Multimedia Programming Guide.
Error: If an error occurs, upon return the NSError object describes the error..

On success, you have an initialized AVAudioPlayer object. On failure, the Error parameter contains a code that describes the problem.

See also:

Some examples using this method:

AVAudioPlayerMBS.audioPlayerWithFile(File as folderitem, fileTypeHintUtiString as string, byref error as NSErrorMBS) as AVAudioPlayerMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method AVFoundation MBS AVFoundation Plugin 14.4 ✅ Yes ❌ No ❌ No ✅ Yes All
Initializes and returns an audio player using the specified URL and file type hint.

url: A URL identifying the sound file to play. The audio data must be in a format supported by Core Audio.
utiString: A UTI that is used as a file type hint. The supported UTIs are defined in File Format UTIs. See AVFileType* strings.
Error: If an error occurs, upon return the NSError object describes the error.

The utiString file type hint tells the parser what kind of sound data to expect so that files which are not self identifying, or possibly even corrupt, can be successfully parsed.

Available in OS X v10.9 and later, but plugin calls variant without hint for older versions.

See also:

AVAudioPlayerMBS.audioPlayerWithURL(URL as string, byref error as NSErrorMBS) as AVAudioPlayerMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method AVFoundation MBS AVFoundation Plugin 14.4 ✅ Yes ❌ No ❌ No ✅ Yes All
Initializes and returns an audio player for playing a designated sound file.

url: A URL identifying the sound file to play. The audio data must be in a format supported by Core Audio. For a list of supported formats, see "Using Audio" in Multimedia Programming Guide.
Error: If an error occurs, upon return the NSError object describes the error..

On success, you have an initialized AVAudioPlayer object. On failure, the Error parameter contains a code that describes the problem.

See also:

AVAudioPlayerMBS.audioPlayerWithURL(URL as string, fileTypeHintUtiString as string, byref error as NSErrorMBS) as AVAudioPlayerMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method AVFoundation MBS AVFoundation Plugin 14.4 ✅ Yes ❌ No ❌ No ✅ Yes All
Initializes and returns an audio player using the specified URL and file type hint.

url: A URL identifying the sound file to play. The audio data must be in a format supported by Core Audio.
utiString: A UTI that is used as a file type hint. The supported UTIs are defined in File Format UTIs. See AVFileType* strings.
Error: If an error occurs, upon return the NSError object describes the error.

The utiString file type hint tells the parser what kind of sound data to expect so that files which are not self identifying, or possibly even corrupt, can be successfully parsed.

Available in OS X v10.9 and later, but plugin calls variant without hint for older versions.

See also:

AVAudioPlayerMBS.available as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method AVFoundation MBS AVFoundation Plugin 13.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Whether this class is available.

Returns true on Mac OS X 10.7 and newer.

The items on this page are in the following plugins: MBS AVFoundation Plugin.


The biggest plugin in space...