mirror of
https://github.com/streamyfin/streamyfin.git
synced 2026-07-19 02:34:17 +01:00
android implementation
This commit is contained in:
@@ -115,6 +115,18 @@ final class MPVLayerRenderer {
|
||||
checkError(mpv_set_option_string(handle, "hwdec", "videotoolbox"))
|
||||
checkError(mpv_set_option_string(handle, "hwdec-codecs", "all"))
|
||||
checkError(mpv_set_option_string(handle, "hwdec-software-fallback", "no"))
|
||||
|
||||
// Seeking optimization - faster seeking at the cost of less precision
|
||||
// Use keyframe seeking by default (much faster for network streams)
|
||||
checkError(mpv_set_option_string(handle, "hr-seek", "no"))
|
||||
// Drop frames during seeking for faster response
|
||||
checkError(mpv_set_option_string(handle, "hr-seek-framedrop", "yes"))
|
||||
|
||||
// Demuxer cache settings for better network streaming
|
||||
checkError(mpv_set_option_string(handle, "cache", "yes"))
|
||||
checkError(mpv_set_option_string(handle, "demuxer-max-bytes", "150MiB"))
|
||||
checkError(mpv_set_option_string(handle, "demuxer-max-back-bytes", "75MiB"))
|
||||
checkError(mpv_set_option_string(handle, "demuxer-readahead-secs", "20"))
|
||||
|
||||
// Subtitle and audio settings
|
||||
checkError(mpv_set_option_string(mpv, "subs-match-os-language", "yes"))
|
||||
@@ -369,8 +381,18 @@ final class MPVLayerRenderer {
|
||||
}
|
||||
}
|
||||
|
||||
case MPV_EVENT_SEEK:
|
||||
// Seek started - show loading indicator
|
||||
if !isLoading {
|
||||
isLoading = true
|
||||
DispatchQueue.main.async { [weak self] in
|
||||
guard let self else { return }
|
||||
self.delegate?.renderer(self, didChangeLoading: true)
|
||||
}
|
||||
}
|
||||
|
||||
case MPV_EVENT_PLAYBACK_RESTART:
|
||||
// Video playback has started/restarted
|
||||
// Video playback has started/restarted (including after seek)
|
||||
if isLoading {
|
||||
isLoading = false
|
||||
DispatchQueue.main.async { [weak self] in
|
||||
|
||||
@@ -109,6 +109,9 @@ final class PiPController: NSObject {
|
||||
}
|
||||
|
||||
func updatePlaybackState() {
|
||||
// Only invalidate when PiP is active to avoid "no context menu visible" warnings
|
||||
guard isPictureInPictureActive else { return }
|
||||
|
||||
if Thread.isMainThread {
|
||||
pipController?.invalidatePlaybackState()
|
||||
} else {
|
||||
@@ -127,8 +130,10 @@ final class PiPController: NSObject {
|
||||
CMTimebaseSetTime(tb, time: time)
|
||||
}
|
||||
|
||||
// Always invalidate to refresh the PiP UI
|
||||
updatePlaybackState()
|
||||
// Only invalidate when PiP is active to avoid unnecessary updates
|
||||
if isPictureInPictureActive {
|
||||
updatePlaybackState()
|
||||
}
|
||||
}
|
||||
|
||||
/// Updates the current playback time from seconds
|
||||
|
||||
Reference in New Issue
Block a user