mirror of
https://gh-proxy.org/https://github.com/tiajinsha/JKVideo
synced 2026-07-07 23:18:38 +08:00
fix: quality switch not updating video playback
- Use qn-specific MPD filename (bili_dash_{qn}.mpd) so each quality
produces a distinct URI that triggers react-native-video to reload
- Add key={resolvedUrl} on <Video> to force remount on source change
This commit is contained in:
@@ -57,6 +57,7 @@ export function NativeVideoPlayer({
|
||||
<View style={[styles.container, style]}>
|
||||
{resolvedUrl ? (
|
||||
<Video
|
||||
key={resolvedUrl}
|
||||
ref={videoRef}
|
||||
source={isDash
|
||||
? { uri: resolvedUrl, type: 'mpd', headers: BILIBILI_HEADERS }
|
||||
|
||||
@@ -7,7 +7,7 @@ import type { PlayUrlResponse } from '../services/types';
|
||||
*/
|
||||
export async function buildDashMpdUri(playData: PlayUrlResponse, qn: number): Promise<string> {
|
||||
const xml = buildMpdXml(playData, qn);
|
||||
const path = `${FileSystem.cacheDirectory}bili_dash.mpd`;
|
||||
const path = `${FileSystem.cacheDirectory}bili_dash_${qn}.mpd`;
|
||||
await FileSystem.writeAsStringAsync(path, xml, { encoding: FileSystem.EncodingType.UTF8 });
|
||||
return path;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user