mirror of
https://github.com/yattee/yattee.git
synced 2025-08-09 20:24:06 +00:00
Better UI handling for loading video details (fixes #46)
This commit is contained in:
@@ -62,7 +62,13 @@ extension PlayerModel {
|
||||
preservedTime = currentItem.playbackTime
|
||||
restoreLoadedChannel()
|
||||
|
||||
loadAvailableStreams(currentVideo!)
|
||||
DispatchQueue.main.async { [weak self] in
|
||||
guard let video = self?.currentVideo else {
|
||||
return
|
||||
}
|
||||
|
||||
self?.loadAvailableStreams(video)
|
||||
}
|
||||
}
|
||||
|
||||
func preferredStream(_ streams: [Stream]) -> Stream? {
|
||||
@@ -95,6 +101,9 @@ extension PlayerModel {
|
||||
|
||||
remove(newItem)
|
||||
|
||||
currentItem = newItem
|
||||
player.pause()
|
||||
|
||||
accounts.api.loadDetails(newItem) { newItem in
|
||||
self.playItem(newItem, video: newItem.video, at: time)
|
||||
}
|
||||
@@ -135,6 +144,12 @@ extension PlayerModel {
|
||||
) -> PlayerQueueItem? {
|
||||
let item = PlayerQueueItem(video, playbackTime: atTime)
|
||||
|
||||
if play {
|
||||
currentItem = item
|
||||
// pause playing current video as it's going to be replaced with next one
|
||||
player.pause()
|
||||
}
|
||||
|
||||
queue.insert(item, at: prepending ? 0 : queue.endIndex)
|
||||
|
||||
accounts.api.loadDetails(item) { newItem in
|
||||
|
Reference in New Issue
Block a user