Addressing pr comments

Signed-off-by: Lance Chant <13349722+lancechant@users.noreply.github.com>
This commit is contained in:
Lance Chant
2026-07-04 12:50:18 +02:00
parent 4f31cd2b32
commit c4e5cb9c14
2 changed files with 8 additions and 5 deletions

View File

@@ -582,13 +582,16 @@ class ExoPlayerView(context: Context, appContext: AppContext) : ExpoView(context
p.prepare() p.prepare()
if (wasPlaying) p.play() if (wasPlaying) p.play()
// If text tracks were disabled (e.g. disableSubtitles was called // Re-enabling text tracks alone isn't enough: a prior text override
// earlier, or playback started with subtitles off), the new // (e.g. left in place by disableSubtitles, or set by setSubtitleTrack
// subtitle — even with SELECTION_FLAG_DEFAULT — won't render. // before this add) survives the MediaItem rebuild and, since embedded
// Re-enable the text track type when the caller asks us to select. // subtitle groups persist across it, would win over the new sub's
// SELECTION_FLAG_DEFAULT. Clear any text override so the new default
// sub is the one that renders.
if (select) { if (select) {
val params = p.trackSelectionParameters.buildUpon() val params = p.trackSelectionParameters.buildUpon()
.setTrackTypeDisabled(C.TRACK_TYPE_TEXT, false) .setTrackTypeDisabled(C.TRACK_TYPE_TEXT, false)
.clearOverridesOfType(C.TRACK_TYPE_TEXT)
.build() .build()
p.trackSelectionParameters = params p.trackSelectionParameters = params
} }

View File

@@ -5,7 +5,7 @@ import { useImperativeHandle, useRef } from "react";
import type { import type {
MpvPlayerViewProps, MpvPlayerViewProps,
MpvPlayerViewRef, MpvPlayerViewRef,
} from "../../mpv-player/src/MpvPlayer.types"; } from "@/modules/mpv-player";
const NativeView: React.ComponentType<MpvPlayerViewProps & { ref?: any }> = const NativeView: React.ComponentType<MpvPlayerViewProps & { ref?: any }> =
requireNativeView("ExoPlayer"); requireNativeView("ExoPlayer");