mirror of
https://github.com/yattee/yattee.git
synced 2024-12-23 05:53:41 +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,34 +63,36 @@ struct VideoCell: View {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private func playAction() {
|
private func playAction() {
|
||||||
guard video.videoID != Video.fixtureID else {
|
DispatchQueue.main.async {
|
||||||
return
|
guard video.videoID != Video.fixtureID else {
|
||||||
}
|
return
|
||||||
|
|
||||||
if watchingNow {
|
|
||||||
if !player.playingInPictureInPicture {
|
|
||||||
player.show()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if !playNowContinues {
|
if watchingNow {
|
||||||
player.backend.seek(to: .zero)
|
if !player.playingInPictureInPicture {
|
||||||
|
player.show()
|
||||||
|
}
|
||||||
|
|
||||||
|
if !playNowContinues {
|
||||||
|
player.backend.seek(to: .zero)
|
||||||
|
}
|
||||||
|
|
||||||
|
player.play()
|
||||||
|
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
player.play()
|
var playAt: CMTime?
|
||||||
|
|
||||||
return
|
if playNowContinues,
|
||||||
|
!watch.isNil,
|
||||||
|
!watch!.finished
|
||||||
|
{
|
||||||
|
playAt = .secondsInDefaultTimescale(watch!.stoppedAt)
|
||||||
|
}
|
||||||
|
|
||||||
|
player.play(video, at: playAt, inNavigationView: inNavigationView)
|
||||||
}
|
}
|
||||||
|
|
||||||
var playAt: TimeInterval?
|
|
||||||
|
|
||||||
if playNowContinues,
|
|
||||||
!watch.isNil,
|
|
||||||
!watch!.finished
|
|
||||||
{
|
|
||||||
playAt = watch!.stoppedAt
|
|
||||||
}
|
|
||||||
|
|
||||||
player.play(video, at: playAt, inNavigationView: inNavigationView)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private var playNowContinues: Bool {
|
private var playNowContinues: Bool {
|
||||||
|
Loading…
Reference in New Issue
Block a user