mirror of
https://github.com/yattee/yattee.git
synced 2025-08-09 20:24:06 +00:00
Add buttons to next video and restart video (fix #106)
Previous video requires rebuilding queue a little, maybe in the future
This commit is contained in:
@@ -281,8 +281,12 @@ final class PlayerModel: ObservableObject {
|
||||
}
|
||||
|
||||
func upgradeToStream(_ stream: Stream, force: Bool = false) {
|
||||
guard let video = currentVideo else {
|
||||
return
|
||||
}
|
||||
|
||||
if !self.stream.isNil, force || self.stream != stream {
|
||||
playStream(stream, of: currentVideo!, preservingTime: true, upgrading: true)
|
||||
playStream(stream, of: video, preservingTime: true, upgrading: true)
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -1,10 +1,12 @@
|
||||
import CoreData
|
||||
import CoreMedia
|
||||
import Defaults
|
||||
import Foundation
|
||||
|
||||
@objc(Watch)
|
||||
final class Watch: NSManagedObject, Identifiable {
|
||||
@Default(.watchedThreshold) private var watchedThreshold
|
||||
@Default(.saveHistory) private var saveHistory
|
||||
}
|
||||
|
||||
extension Watch {
|
||||
@@ -45,4 +47,15 @@ extension Watch {
|
||||
formatter.unitsStyle = .full
|
||||
return formatter.localizedString(for: watchedAt, relativeTo: Date())
|
||||
}
|
||||
|
||||
var timeToRestart: CMTime? {
|
||||
finished ? nil : saveHistory ? .secondsInDefaultTimescale(stoppedAt) : nil
|
||||
}
|
||||
|
||||
var video: Video {
|
||||
Video(
|
||||
videoID: videoID, title: "", author: "",
|
||||
length: 0, published: "", views: -1, channel: Channel(id: "", name: "")
|
||||
)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user