mirror of
https://github.com/yattee/yattee.git
synced 2025-08-06 18:54:11 +00:00
Add new menus
This commit is contained in:
@@ -43,7 +43,6 @@ final class PlayerModel: ObservableObject {
|
||||
@Published var restoredSegments = [Segment]()
|
||||
|
||||
var accounts: AccountsModel
|
||||
var instances: InstancesModel
|
||||
|
||||
var composition = AVMutableComposition()
|
||||
|
||||
@@ -67,9 +66,8 @@ final class PlayerModel: ObservableObject {
|
||||
#endif
|
||||
}}
|
||||
|
||||
init(accounts: AccountsModel? = nil, instances: InstancesModel? = nil) {
|
||||
init(accounts: AccountsModel? = nil, instances _: InstancesModel? = nil) {
|
||||
self.accounts = accounts ?? AccountsModel()
|
||||
self.instances = instances ?? InstancesModel()
|
||||
|
||||
addItemDidPlayToEndTimeObserver()
|
||||
addFrequentTimeObserver()
|
||||
@@ -81,6 +79,10 @@ final class PlayerModel: ObservableObject {
|
||||
presentingPlayer = true
|
||||
}
|
||||
|
||||
func togglePlayer() {
|
||||
presentingPlayer.toggle()
|
||||
}
|
||||
|
||||
var isPlaying: Bool {
|
||||
player.timeControlStatus == .playing
|
||||
}
|
||||
|
@@ -22,7 +22,7 @@ extension PlayerModel {
|
||||
availableStreams = []
|
||||
var instancesWithLoadedStreams = [Instance]()
|
||||
|
||||
instances.all.forEach { instance in
|
||||
InstancesModel.all.forEach { instance in
|
||||
fetchStreams(instance.anonymous.video(video.videoID), instance: instance, video: video) { _ in
|
||||
self.completeIfAllInstancesLoaded(
|
||||
instance: instance,
|
||||
@@ -59,7 +59,7 @@ extension PlayerModel {
|
||||
instancesWithLoadedStreams.append(instance)
|
||||
rebuildTVMenu()
|
||||
|
||||
if instances.all.count == instancesWithLoadedStreams.count {
|
||||
if InstancesModel.all.count == instancesWithLoadedStreams.count {
|
||||
completionHandler(streams.sorted { $0.kind < $1.kind })
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user