mirror of
https://github.com/streamyfin/streamyfin.git
synced 2026-07-07 13:02:52 +01:00
fix(mpv): re-emit tracksReady after FILE_LOADED to win the disable race
Initial subtitle selection now comes from JS on tracksReady; FILE_LOADED still disables subtitles, which could wipe a JS selection that landed first on embedded-only files (no later track-list change to re-fire). Re-emitting tracksReady after the disable guarantees the idempotent JS re-apply always runs last. Also guards the iOS track-id read against failure, matching Android.
This commit is contained in:
@@ -851,6 +851,13 @@ class MPVLayerRenderer(private val context: Context) : MPVLib.EventObserver {
|
||||
initialAudioId?.let { if (it > 0) setAudioTrack(it) }
|
||||
initialSubtitleId?.let { setSubtitleTrack(it) } ?: disableSubtitles()
|
||||
|
||||
// The disable above can race a JS-side identity selection that
|
||||
// landed before FILE_LOADED (JS no longer passes an initial sid).
|
||||
// Re-emit tracksReady so the idempotent JS re-apply always runs
|
||||
// after it — for embedded-only files this is the only
|
||||
// post-FILE_LOADED fire.
|
||||
mainHandler.post { delegate?.onTracksReady() }
|
||||
|
||||
if (!isReadyToSeek) {
|
||||
isReadyToSeek = true
|
||||
mainHandler.post { delegate?.onReadyToSeek() }
|
||||
|
||||
Reference in New Issue
Block a user