Run play action async

This commit is contained in:
Arkadiusz Fal 2022-04-17 11:34:26 +02:00
parent 52df6bf76e
commit 6376e573b1

View File

@ -1,3 +1,4 @@
import CoreMedia
import Defaults
import SDWebImageSwiftUI
import SwiftUI
@ -62,6 +63,7 @@ struct VideoCell: View {
}
private func playAction() {
DispatchQueue.main.async {
guard video.videoID != Video.fixtureID else {
return
}
@ -80,17 +82,18 @@ struct VideoCell: View {
return
}
var playAt: TimeInterval?
var playAt: CMTime?
if playNowContinues,
!watch.isNil,
!watch!.finished
{
playAt = watch!.stoppedAt
playAt = .secondsInDefaultTimescale(watch!.stoppedAt)
}
player.play(video, at: playAt, inNavigationView: inNavigationView)
}
}
private var playNowContinues: Bool {
watchedVideoPlayNowBehavior == .continue