Skip to content

Commit

Permalink
Add playerPlaybackDidLoop delegate method
Browse files Browse the repository at this point in the history
  • Loading branch information
qubblr committed Nov 18, 2019
1 parent 33292f4 commit 53cee49
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
4 changes: 3 additions & 1 deletion Project/Player/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,8 @@ extension ViewController: PlayerPlaybackDelegate {

func playerPlaybackWillLoop(_ player: Player) {
}


func playerPlaybackDidLoop(_ player: Player) {
}
}

4 changes: 3 additions & 1 deletion Project/PlayerTV/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,8 @@ extension ViewController: PlayerPlaybackDelegate {

func playerPlaybackWillLoop(_ player: Player) {
}


func playerPlaybackDidLoop(_ player: Player) {
}
}

2 changes: 2 additions & 0 deletions Sources/Player.swift
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ public protocol PlayerPlaybackDelegate: AnyObject {
func playerPlaybackWillStartFromBeginning(_ player: Player)
func playerPlaybackDidEnd(_ player: Player)
func playerPlaybackWillLoop(_ player: Player)
func playerPlaybackDidLoop(_ player: Player)
}

// MARK: - Player
Expand Down Expand Up @@ -652,6 +653,7 @@ extension Player {
self._avplayer.pause()
self._avplayer.seek(to: CMTime.zero)
self._avplayer.play()
self.playbackDelegate?.playerPlaybackDidLoop(self)
} else if self.playbackFreezesAtEnd {
self.stop()
} else {
Expand Down

0 comments on commit 53cee49

Please sign in to comment.