mirror of
https://github.com/yattee/yattee.git
synced 2024-12-22 21:43:41 +00:00
Restart finished video
After the video has ended, hitting play restarts the video from the beginning fixes #449 If I understand the issue correctly, however, videos can now be played again without hitting the "Start from the beginning" button.
This commit is contained in:
parent
d1cf45c6a1
commit
86b91916a7
@ -160,6 +160,13 @@ final class AVPlayerBackend: PlayerBackend {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// After the video has ended, hitting play restarts the video from the beginning.
|
||||||
|
if currentTime?.seconds.formattedAsPlaybackTime() == model.playerTime.duration.seconds.formattedAsPlaybackTime() &&
|
||||||
|
currentTime!.seconds > 0 && model.playerTime.duration.seconds > 0
|
||||||
|
{
|
||||||
|
seek(to: 0, seekType: .loopRestart)
|
||||||
|
}
|
||||||
|
|
||||||
avPlayer.play()
|
avPlayer.play()
|
||||||
model.objectWillChange.send()
|
model.objectWillChange.send()
|
||||||
}
|
}
|
||||||
|
@ -354,6 +354,13 @@ final class MPVBackend: PlayerBackend {
|
|||||||
|
|
||||||
setRate(model.currentRate)
|
setRate(model.currentRate)
|
||||||
|
|
||||||
|
// After the video has ended, hitting play restarts the video from the beginning.
|
||||||
|
if currentTime?.seconds.formattedAsPlaybackTime() == model.playerTime.duration.seconds.formattedAsPlaybackTime() &&
|
||||||
|
currentTime!.seconds > 0 && model.playerTime.duration.seconds > 0
|
||||||
|
{
|
||||||
|
seek(to: 0, seekType: .loopRestart)
|
||||||
|
}
|
||||||
|
|
||||||
client?.play()
|
client?.play()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -519,8 +526,6 @@ final class MPVBackend: PlayerBackend {
|
|||||||
guard client.eofReached else {
|
guard client.eofReached else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
getTimeUpdates()
|
|
||||||
eofPlaybackModeAction()
|
eofPlaybackModeAction()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user