mirror of
https://github.com/yattee/yattee.git
synced 2024-12-23 05:53:41 +00:00
6eba2a45c8
I added a new feature. When instances are not proxied, Yattee first checks the URL to make sure it is not a restricted video. Usually, music videos and sports content can only be played back by the same IP address that requested the URL in the first place. That is why some videos do not play when the proxy is disabled. This approach has multiple advantages. First and foremost, It reduced the load on Invidious/Piped instances, since users can now directly access the videos without going through the instance, which might be severely bandwidth limited. Secondly, users don't need to manually turn on the proxy when they want to watch IP address bound content, since Yattee automatically proxies such content. Furthermore, adding the proxy option allows mitigating some severe playback issues with invidious instances. Invidious by default returns proxied URLs for videos, and due to some bug in the Invidious proxy, scrubbing or continuing playback at a random timestamp can lead to severe wait times for the users. This should fix numerous playback issues: #666, #626, #590, #585, #498, #457, #400
48 lines
1.3 KiB
Swift
48 lines
1.3 KiB
Swift
import SwiftUI
|
|
|
|
struct OpeningStream: View {
|
|
@ObservedObject private var player = PlayerModel.shared
|
|
@ObservedObject private var model = NetworkStateModel.shared
|
|
|
|
var body: some View {
|
|
Buffering(reason: reason, state: state)
|
|
.opacity(visible ? 1 : 0)
|
|
}
|
|
|
|
var visible: Bool {
|
|
(!player.currentItem.isNil && !player.videoBeingOpened.isNil) ||
|
|
(player.isLoadingVideo && !model.pausedForCache && !player.isSeeking) ||
|
|
!player.hasStarted
|
|
}
|
|
|
|
var reason: String {
|
|
guard player.videoBeingOpened == nil else {
|
|
return "Loading streams…".localized()
|
|
}
|
|
|
|
if player.musicMode {
|
|
return "Opening audio stream…".localized()
|
|
}
|
|
|
|
if let selection = player.streamSelection {
|
|
if selection.isLocal {
|
|
return "Opening file…".localized()
|
|
}
|
|
return String(format: "Opening %@ stream…".localized(), selection.shortQuality)
|
|
}
|
|
|
|
return "Loading streams…".localized()
|
|
}
|
|
|
|
var state: String? {
|
|
player.videoBeingOpened.isNil ? model.bufferingStateText : nil
|
|
}
|
|
}
|
|
|
|
struct OpeningStream_Previews: PreviewProvider {
|
|
static var previews: some View {
|
|
OpeningStream()
|
|
.injectFixtureEnvironmentObjects()
|
|
}
|
|
}
|