mirror of
https://github.com/yattee/yattee.git
synced 2025-08-06 10:44:06 +00:00
PiP and UI improvements
This commit is contained in:
@@ -47,8 +47,12 @@ struct Instance: Defaults.Serializable, Hashable, Identifiable {
|
||||
URLComponents(string: apiURL)!
|
||||
}
|
||||
|
||||
var frontendHost: String {
|
||||
URLComponents(string: frontendURL!)!.host!
|
||||
var frontendHost: String? {
|
||||
guard let url = app == .invidious ? apiURL : frontendURL else {
|
||||
return nil
|
||||
}
|
||||
|
||||
return URLComponents(string: url)?.host
|
||||
}
|
||||
|
||||
func hash(into hasher: inout Hasher) {
|
||||
|
@@ -1,4 +1,3 @@
|
||||
|
||||
import Defaults
|
||||
import Foundation
|
||||
|
||||
|
@@ -26,7 +26,7 @@ protocol VideosAPI {
|
||||
func channelPlaylist(_ id: String) -> Resource?
|
||||
|
||||
func loadDetails(_ item: PlayerQueueItem, completionHandler: @escaping (PlayerQueueItem) -> Void)
|
||||
func shareURL(_ item: ContentItem) -> URL
|
||||
func shareURL(_ item: ContentItem) -> URL?
|
||||
}
|
||||
|
||||
extension VideosAPI {
|
||||
@@ -48,9 +48,13 @@ extension VideosAPI {
|
||||
}
|
||||
}
|
||||
|
||||
func shareURL(_ item: ContentItem) -> URL {
|
||||
func shareURL(_ item: ContentItem) -> URL? {
|
||||
guard let frontendHost = account.instance.frontendHost else {
|
||||
return nil
|
||||
}
|
||||
|
||||
var urlComponents = account.instance.urlComponents
|
||||
urlComponents.host = account.instance.frontendHost
|
||||
urlComponents.host = frontendHost
|
||||
|
||||
switch item.contentType {
|
||||
case .video:
|
||||
|
@@ -13,7 +13,8 @@ final class PlayerModel: ObservableObject {
|
||||
let logger = Logger(label: "net.arekf.Pearvidious.ps")
|
||||
|
||||
private(set) var player = AVPlayer()
|
||||
var controller: PlayerViewController?
|
||||
private(set) var playerView = Player()
|
||||
var controller: PlayerViewController? { didSet { playerView.controller = controller } }
|
||||
#if os(tvOS)
|
||||
var avPlayerViewController: AVPlayerViewController?
|
||||
#endif
|
||||
@@ -52,6 +53,8 @@ final class PlayerModel: ObservableObject {
|
||||
|
||||
private var timeObserverThrottle = Throttle(interval: 2)
|
||||
|
||||
var playingInPictureInPicture = false
|
||||
|
||||
init(accounts: AccountsModel? = nil, instances: InstancesModel? = nil) {
|
||||
self.accounts = accounts ?? AccountsModel()
|
||||
self.instances = instances ?? InstancesModel()
|
||||
|
Reference in New Issue
Block a user