TheWidlarzGroup / react-native-video

A <Video /> component for react-native
MIT License
7.07k stars 2.85k forks source link

[BUG]: hls video plays slowly only on ios #3854

Open hasan-soliev opened 1 month ago

hasan-soliev commented 1 month ago

Version

6.1.0

What platforms are you having the problem on?

iOS

Architecture

New architecture with interop layer

What happened?

hls video plays slowly only on ios and only on a real phone on the emulator 7-8 seconds for the same video on the phone up to 20 seconds on android everything works fine

Reproduction

repository link

Reproduction

Step to reproduce this bug are:

hasan-soliev commented 1 month ago

this video used https://demo.unified-streaming.com/k8s/features/stable/video/tears-of-steel/tears-of-steel.mp4/.m3u8

freeboub commented 1 month ago

Please provide how you use the package and a sample url

hasan-soliev commented 1 month ago

Укажите, как вы используете пакет, и пример URL.

<VideoPlayer ref={videoRef} source={{ uri: 'https://demo.unified-streaming.com/k8s/features/stable/video/tears-of-steel/tears-of-steel.mp4/.m3u8', headers: { 'Accept-Encoding': 'deflate', }, }} style={fullScreen || pictureInPicture ? styles.fullScreen : inline} resizeMode={videoResizeMode} hideShutterView={true} muted={muted} rate={1} paused={paused} volume={volume} onLoadStart={() => onLoadStart()} bufferConfig={{ minBufferMs: bufferConfig.minBufferMs, maxBufferMs: bufferConfig.maxBufferMs, bufferForPlaybackMs: bufferConfig.bufferForPlaybackMs, bufferForPlaybackAfterRebufferMs: bufferConfig.bufferForPlaybackAfterRebufferMs, }} playInBackground={playInBackground} playWhenInactive={true} ignoreSilentSwitch={'ignore'} pictureInPicture={pictureInPicture} minLoadRetryCount={1000} onBuffer={info => { if (paused) { setLoading(false); } else { setLoading(info.isBuffering); } onBuffer(info); }} onPictureInPictureStatusChanged={e => { if (e.isActive) { setPictureInPicture(true); setPlaInBackground(true); } else { setPictureInPicture(false); } }} onProgress={t => { setCurrentTime(t.currentTime); onProgress(t); }} onLoad={e => { if (videoRef.current && seekToOnLoad && player == 'movie') { // setLoading(false); videoRef.current.seek(seekToOnLoad); } else { // console.log('Invalid seek position:', seekToOnLoad); } }} progressUpdateInterval={noVideo ? 1000 : 250} selectedAudioTrack={ playUrl == undefined ? {type: 'index', value: parseInt(audioTracks)} : undefined } onEnd={onVideoEnd} playerTransport={1} />

freeboub commented 1 month ago

I just try to put the sample url in the sample included in the repo, I don't reproduce the issue. Can you please check if one the the prop you causes the issue ?

hasan-soliev commented 1 month ago

here is an example video https://github.com/TheWidlarzGroup/react-native-video/assets/158991546/e2f8c90c-8c8a-45ba-8284-db4a8cad9f31

freeboub commented 4 weeks ago

The video doesn't help ... please try to simplify your code, for exemple,

onProgress={t => {
setCurrentTime(t.currentTime);
onProgress(t);
}}

will recreate the callback on every render. It would be really better to extract the function from the <Video tag. This is not a good pratice.

Please remove as much as prop you can remove to identify if the issue is in your usage or if it is really in react native video.

For now we cannot help with informations you provided ...