improvements
This commit is contained in:
@@ -308,10 +308,35 @@ export default function StreamingPlayer({
|
||||
errorMsg = 'Network error while loading video';
|
||||
break;
|
||||
case error.MEDIA_ERR_DECODE:
|
||||
errorMsg = 'Video decoding error';
|
||||
errorMsg = 'Video decoding error - codec not supported';
|
||||
// If HLS is available, try switching to it
|
||||
if (hlsUrl && !hlsRef.current) {
|
||||
console.log('[Video] Decode error detected, switching to HLS transcoding...');
|
||||
// Force HLS playback
|
||||
const hls = new Hls({
|
||||
enableWorker: true,
|
||||
lowLatencyMode: false,
|
||||
});
|
||||
hls.loadSource(hlsUrl);
|
||||
hls.attachMedia(video);
|
||||
hlsRef.current = hls;
|
||||
video.play().catch(console.error);
|
||||
}
|
||||
break;
|
||||
case error.MEDIA_ERR_SRC_NOT_SUPPORTED:
|
||||
errorMsg = 'Video format not supported';
|
||||
// If HLS is available, try switching to it
|
||||
if (hlsUrl && !hlsRef.current) {
|
||||
console.log('[Video] Format not supported, switching to HLS transcoding...');
|
||||
const hls = new Hls({
|
||||
enableWorker: true,
|
||||
lowLatencyMode: false,
|
||||
});
|
||||
hls.loadSource(hlsUrl);
|
||||
hls.attachMedia(video);
|
||||
hlsRef.current = hls;
|
||||
video.play().catch(console.error);
|
||||
}
|
||||
break;
|
||||
}
|
||||
console.error('[Video] Error:', errorMsg, error);
|
||||
|
||||
Reference in New Issue
Block a user