mirror of
https://github.com/yattee/yattee.git
synced 2024-11-10 00:08:21 +00:00
Run play action async
This commit is contained in:
parent
52df6bf76e
commit
6376e573b1
@ -1,3 +1,4 @@
|
|||||||
|
import CoreMedia
|
||||||
import Defaults
|
import Defaults
|
||||||
import SDWebImageSwiftUI
|
import SDWebImageSwiftUI
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
@ -62,6 +63,7 @@ struct VideoCell: View {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private func playAction() {
|
private func playAction() {
|
||||||
|
DispatchQueue.main.async {
|
||||||
guard video.videoID != Video.fixtureID else {
|
guard video.videoID != Video.fixtureID else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -80,17 +82,18 @@ struct VideoCell: View {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
var playAt: TimeInterval?
|
var playAt: CMTime?
|
||||||
|
|
||||||
if playNowContinues,
|
if playNowContinues,
|
||||||
!watch.isNil,
|
!watch.isNil,
|
||||||
!watch!.finished
|
!watch!.finished
|
||||||
{
|
{
|
||||||
playAt = watch!.stoppedAt
|
playAt = .secondsInDefaultTimescale(watch!.stoppedAt)
|
||||||
}
|
}
|
||||||
|
|
||||||
player.play(video, at: playAt, inNavigationView: inNavigationView)
|
player.play(video, at: playAt, inNavigationView: inNavigationView)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private var playNowContinues: Bool {
|
private var playNowContinues: Bool {
|
||||||
watchedVideoPlayNowBehavior == .continue
|
watchedVideoPlayNowBehavior == .continue
|
||||||
|
Loading…
Reference in New Issue
Block a user