Platforms to show: All Mac Windows Linux Cross-Platform
AVPlayerMBS class
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
class | AVFoundation | MBS AVFoundation Plugin | 13.2 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
The multiple-item case supports advanced behaviors.
AVPlayer works equally well with local and remote media files, providing you with appropriate information about readiness to play or about the need to await additional data before continuing.
You can display the visual content of items played by an instance of AVPlayer in a CoreAnimation layer of class AVPlayerLayer; to synchronize real-time playback with other CoreAnimation layers, you can use AVSynchronizedLayer. You cannot use an instance of AVVideoCompositionCoreAnimationTool with an AVPlayer object; for offline rendering you should instead use AVAssetExportSession.
You can observe the status of a player using key-value observing. So that you can add and remove observers safely, AVPlayer serializes notifications of changes that occur dynamically during playback on a dispatch queue. By default, this queue is the main queue . To ensure safe access to a player's nonatomic properties while dynamic changes in playback state may be reported, you must serialize access with the receiver's notification queue. In the common case, such serialization is naturally achieved by invoking AVPlayer's various methods on the main thread or queue.
- 13 properties
- property ActionAtItemEnd as Integer
- property appliesMediaSelectionCriteriaAutomatically as Boolean
- property audioOutputDeviceUniqueID as String
- property ClosedCaptionDisplayEnabled as boolean
- property currentItem as AVPlayerItemMBS
- property currentTime as CMTimeMBS
- property error as NSErrorMBS
- property Handle as Integer
- property Muted as boolean
- property Playing as Boolean
- property rate as Double
- property status as Integer
- property volume as Double
- 20 methods
- method addBoundaryTimeObserverForTime(time as CMTimeMBS, tag as variant = nil) as AVPlayerTimeObserverMBS
- method addBoundaryTimeObserverForTimes(times() as CMTimeMBS, tag as Variant = nil) as AVPlayerTimeObserverMBS
- method addLoopTimeObserver(atTime as CMTimeMBS, jumpToTime as CMTimeMBS) as AVPlayerTimeObserverMBS
- method addPeriodicTimeObserverForInterval(interval as CMTimeMBS, tag as Variant = nil) as AVPlayerTimeObserverMBS
- method cancelPendingPrerolls
- method Constructor
- method Constructor(File as folderitem)
- method Constructor(item as AVPlayerItemMBS)
- method Constructor(URL as string)
- method mediaSelectionCriteriaForMediaCharacteristic(mediaCharacteristic as string) as AVPlayerMediaSelectionCriteriaMBS
- method pause
- method play
- method prerollAtRate(rate as Double, tag as Variant)
- method replaceCurrentItemWithPlayerItem(item as AVPlayerItemMBS)
- method seekToDate(date as date, fireEvent as boolean = false, tag as Variant = nil)
- method seekToDate(date as dateTime, fireEvent as boolean = false, tag as variant = nil)
- method seekToTime(time as CMTimeMBS, fireEvent as boolean = false, tag as Variant = nil)
- method seekToTime(time as CMTimeMBS, toleranceBefore as CMTimeMBS, toleranceAfter as CMTimeMBS, fireEvent as boolean = false, tag as Variant = nil)
- method setMediaSelectionCriteria(criteria as AVPlayerMediaSelectionCriteriaMBS, mediaCharacteristic as string)
- method setRate(rate as Double, time as CMTimeMBS, HostTime as CMTimeMBS)
- 5 shared methods
- shared method available as boolean
- shared method playerWithFile(File as folderitem) as AVPlayerMBS
- shared method playerWithPlayerItem(item as AVPlayerItemMBS) as AVPlayerMBS
- shared method playerWithURL(URL as string) as AVPlayerMBS
- shared method removeTimeObserver(observer as AVPlayerTimeObserverMBS)
- 6 constants
Actions for the item end Constants
Constant | Value | Description |
---|---|---|
AVPlayerActionAtItemEndAdvance | 0 |
Indicates that the player should advance to the next item, if there is one. |
AVPlayerActionAtItemEndNone | 2 |
Indicates that the player should do nothing. |
AVPlayerActionAtItemEndPause | 1 |
Indicates that the player should pause playing. |
Status Constants
Constant | Value | Description |
---|---|---|
AVPlayerStatusFailed | 2 |
Indicates that the player can no longer play AVPlayerItem instances because of an error. The error is described by the value of the player's error property. |
AVPlayerStatusReadyToPlay | 1 |
Indicates that the player is ready to play AVPlayerItem instances. |
AVPlayerStatusUnknown | 0 |
Indicates that the status of the player is not yet known because it has not tried to load new media resources for playback. |
Sub classes:
Some methods using this class:
- AVPlayerLayerMBS.Constructor(player as AVPlayerMBS)
- AVPlayerLayerMBS.playerLayerWithPlayer(player as AVPlayerMBS) as AVPlayerLayerMBS
- DesktopMoviePlayer.AVPlayerMBS as AVPlayerMBS
- MoviePlayer.AVPlayerMBS as AVPlayerMBS
Some properties using for this class:
- AVPlayerViewControlMBS.player as AVPlayerMBS
- AVRoutePickerViewControlMBS.player as AVPlayerMBS
- DesktopAVPlayerViewControlMBS.player as AVPlayerMBS
- DesktopAVRoutePickerViewControlMBS.player as AVPlayerMBS
- AVPlayerLayerMBS.player as AVPlayerMBS
Some events using this class:
- AVFoundationMBS.BoundaryTimeObserver(Player as AVPlayerMBS, tag as Variant)
- AVFoundationMBS.PeriodicTimeObserver(Player as AVPlayerMBS, time as CMTimeMBS, tag as Variant)
- AVFoundationMBS.playerSeekToDateFinished(player as AVPlayerMBS, date as Variant, finished as boolean, tag as Variant)
- AVFoundationMBS.playerSeekToTimeFinished(player as AVPlayerMBS, time as CMTimeMBS, toleranceBefore as CMTimeMBS, toleranceAfter as CMTimeMBS, finished as boolean, tag as Variant)
Some examples using this class:
- /AVFoundation/AVPlayerView test
- /AVFoundation/AVRoutePickerView test
- /AVFoundation/Donut Video Player
- /AVFoundation/Donut Video Player Overlay
- /AVFoundation/MoviePlayer Rate
- /AVFoundation/Simple Player
- /AVFoundation/Transparent Player
Blog Entries
- New in the MBS Xojo Plugins Version 20.2
- MBS Xojo Plugins, version 19.0pr6
- MBS Xojo Plugins, version 18.4pr5
- Tip of the day: MoviePlayer.rate
Xojo Developer Magazine
Videos
Release notes
- Version 19.0
- Added addBoundaryTimeObserverForTime and addLoopTimeObserver methods to AVPlayerMBS class.
- Version 18.4
- Added AVPlayerMBS Playing property.
The items on this page are in the following plugins: MBS AVFoundation Plugin.
AVPlayerLooperMBS - AVPlayerMediaSelectionCriteriaMBS