Class

AVMIDIPlayer

A player for music file formats such as MIDI and iMelody.

Declaration

class AVMIDIPlayer : NSObject

Topics

Creating a MIDI Player

init(contentsOf: URL, soundBankURL: URL?)

Initializes a newly allocated MIDI player with the contents of the file specified by the URL, using the specified sound bank.

init(data: Data, soundBankURL: URL?)

Initializes a newly allocated MIDI player with the contents of the data object.

Playing Content

func prepareToPlay()

Prepares to play the sequence by prerolling all events.

var isPlaying: Bool

A Boolean value that indicates whether the sequence is playing.

func stop()

Stops playing the sequence.

var duration: TimeInterval

The length of the currently loaded file, in seconds.

var currentPosition: TimeInterval

The current playback position, in seconds.

var rate: Float

The playback rate of the player.

Constants

typealias AVMIDIPlayerCompletionHandler

A block to be called when a MIDI playback request is completed.

Relationships

Inherits From

Conforms To

See Also

Single Track Playback and Recording

class AVAudioPlayer

An audio player that provides playback of audio data from a file or memory.

class AVAudioRecorder

A class that provides audio recording capability in your application.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software