HighlightVideoPlayer
public final class HighlightVideoPlayer : ObservableObject
Video player that can play a list of highlights
Each HighlightObject should have chunkName pointing to the video file
-
Initialize the player with the list of highlights
Declaration
Swift
public init(items: [HighlightObject], loopMode: LoopMode = .onlyOne)Parameters
itemslist of highlights
loopModelooping mode to use, defaults to
.onlyOne -
AVPlayer object that plays the video
Declaration
Swift
public private(set) var player: AVPlayer { get } -
Read-only property to get the list of highlights
Declaration
Swift
public private(set) var items: [HighlightObject] { get } -
Index of the current highlight inside the list that we play
Declaration
Swift
@Published public var currentItemIdx: Int { get set } -
Current highlight we play
Declaration
Swift
public var currentHighlight: HighlightObject? { get } -
Current AVPlayerItem that is played
Declaration
Swift
@Published public private(set) var currentItem: AVPlayerItem? { get set } -
size of the video
Declaration
Swift
public var videoSize: CGSize? -
If video is muted or not
Declaration
Swift
public var isMuted: Bool { get set } -
Video player looping mode
Declaration
Swift
public var loopMode: LoopMode -
Do we play the very first item
Declaration
Swift
public var isFirst: Bool { get } -
Do we play the very last item
Declaration
Swift
public var isLast: Bool { get } -
Is playing or not
Declaration
Swift
public private(set) var isPlaying: Bool { get } -
Callback that is called every time when the current item changes
Declaration
Swift
public var onPlayerItemChange: ((_ idx: Int, _ playerItem: AVPlayerItem?, _ obj: HighlightObject?) -> Void)? -
Callback that is called periodically (at least 10 time per second) to update the playing progress Won’t be called if the video is paused
Declaration
Swift
public var onPlayingUpdate: ((_ time: CMTime, _ percent: CGFloat) -> Void)? -
Seek to the start of the current highlight
Declaration
Swift
public func seekToStart() -
Play next highlight
Note
This will loop to the first highlight if called on the last oneDeclaration
Swift
public func playNext() -
Play previous highlight
Note
This will loop to the last highlight if called on the first oneDeclaration
Swift
public func playPrev() -
Play the highlight
Declaration
Swift
public func play(itemIdx: Int? = nil)Parameters
itemIdxindex of the highlight in the list to play. Pass
nilto play the current highlight -
Pause the playback
Declaration
Swift
public func pause() -
Call to free the internal structures when you done with the video player
Note
this method will be called automatically ondeinitDeclaration
Swift
public func clearItems()
HighlightVideoPlayer Class Reference