Platforms to show: All Mac Windows Linux Cross-Platform
AVPlayerLooperMBS class
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
class | AVFoundation | MBS AVFoundation Plugin | 22.3 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
Example:
// Create player and configure
Dim player As New AVQueuePlayerMBS
Dim playerLayer As New AVPlayerLayerMBS(player)
player.pause
// Create looping item
Dim file As FolderItem = SpecialFolder.Desktop.Child("loop.mov")
Dim itemToLoop As New AVPlayerItemMBS(file)
// Create looping helper object. Loop item segment from 5sec to 7sec
Dim startTime As CMTimeMBS = CMTimeMBS.Make(5000, 1000)
Dim duration As CMTimeMBS = CMTimeMBS.Make(2000, 1000)
Dim timeRange As CMTimeRangeMBS = CMTimeRangeMBS.Make(startTime, duration)
Dim looper As New AVPlayerLooperMBS(player, itemToLoop, timeRange)
// Perform any other set up operations like setting AVPlayerItemDataOutputs on the looping item replicas
// Start playback
player.play
// itemToLoop between 5s and 7s plays repeatedly
'....
// To end the looping
looper.disableLooping
// Player will play through the end of the current looping item
The same result can be accomplished with AVQueuePlayer directly, but AVPlayerLooper provides a simpler interface to loop a single AVPlayerItem with an option to specify a time range. AVPlayerLooper only supports looping for forward playback (positive player rate). Behavior is undefined for negative player rate.
Note that the transition at the loop point is not guaranteed to be gapless.
Requires macOS 10.13, iOS 10.0 or newer.
- 5 properties
- property error as NSErrorMBS
- property Handle as Integer
- property item as AVPlayerItemMBS
- property loopCount as Integer
- property status as Integer
- 4 methods
- method Constructor(player as AVQueuePlayerMBS, item as AVPlayerItemMBS)
- method Constructor(player as AVQueuePlayerMBS, item as AVPlayerItemMBS, loopRange as CMTimeRangeMBS)
- method disableLooping
- method loopingPlayerItems as AVPlayerItemMBS()
- shared method available as boolean
- 4 constants
Status
Constant | Value | Description |
---|---|---|
StatusCancelled | 3 |
Indicates that the looper is no longer looping because -disableLooping was invoked. |
StatusFailed | 2 |
Indicates that the looper is not able to perform looping playback because of an error. The error is described by the value of the error property. |
StatusReady | 1 |
Indicates that the looper is ready for looping playback. |
StatusUnknown | 0 |
Indicates that the status of the looper is not yet known. |
This class has no sub classes.
Blog Entries
- News from the MBS Xojo Plugins Version 22.3
- MBS Xojo Plugins in version 22.3
- MBS Xojo Plugins, version 22.3pr1
Xojo Developer Magazine
The items on this page are in the following plugins: MBS AVFoundation Plugin.
AVPlayerLayerMBS - AVPlayerMBS
