react-native-vlc-media-player icon indicating copy to clipboard operation
react-native-vlc-media-player copied to clipboard

onProgress not working on IOS

Open yedi97 opened this issue 1 year ago • 10 comments

Callback onProgress not working with iOS, work fine on Android, Please help me resolved issue, I spent more than 3 days with it

- react-native-vlc-media-player": "1.0.53
- react-native": "^0.71.7
<VLCPlayer
  autoplay={true}
  videoAspectRatio={videoAspectRatio}
  autoAspectRatio={true}
  style={{
    height:
      ORIENTATION === "PORTRAIT"
        ? widthScreen * (9 / 16)
        : widthScreen,
  }}
  source={{
    initType: 2,
    hwDecoderEnabled: 1,
    hwDecoderForced: 1,
    uri: cameraInfo?.rtsp_public || "",
    initOptions: [
      "--rtsp-tcp",
      "--network-caching=150",
      "--rtsp-caching=150",
      "--no-stats",
      "--tcp-caching=150",
      "--realrtsp-caching=150",
    ],
  }}
  Orientation={Orientation}
  isLive={true}
  autoReloadLive={true}
  //   onLoad={(load) => console.log("load", load)}
  //   onEnd={(end) => console.log("onEnded", end)}
  onPlaying={(e) => {
    // setLoading(false);
    console.log("aaa", e);
  }}
  onProgress={(progress) => console.log('progress', progress)}
/>

Thanks!

yedi97 avatar Apr 28 '23 09:04 yedi97

@razorRun please help me or tell me where i went wrong

yedi97 avatar May 11 '23 04:05 yedi97

Are you guys getting the live video feed under 1 seconds?? of Latency??

vishaldybot avatar Aug 12 '23 08:08 vishaldybot

Are you guys getting the live video feed under 1 seconds?? of Latency??

yeah it seems like with delay onProgress works, live doesn't

yedi97 avatar Oct 03 '23 04:10 yedi97

Actually, problem can be solved quite easily. If you look at iOS bindings sources here, you can find that onProgress event fires only when condition currentTime >= 0 && currentTime < duration is met. If you do NSLog, you will see that duration for RTSP live video is always 0. You can fix condition the way you want or even remove it alltogether if you wish so. In general, when dealing with such problems, comparing Java and Obj-C sources helps A LOT. Condition mentioned above is just not present on Android.

degorov avatar Nov 21 '23 07:11 degorov

Actually, problem can be solved quite easily. If you look at iOS bindings sources here, you can find that onProgress event fires only when condition currentTime >= 0 && currentTime < duration is met. If you do NSLog, you will see that duration for RTSP live video is always 0. You can fix condition the way you want or even remove it alltogether if you wish so. In general, when dealing with such problems, comparing Java and Obj-C sources helps A LOT. Condition mentioned above is just not present on Android.

Thank you, i will try soon

yedi97 avatar Nov 21 '23 07:11 yedi97

Actually, problem can be solved quite easily. If you look at iOS bindings sources here, you can find that onProgress event fires only when condition currentTime >= 0 && currentTime < duration is met. If you do NSLog, you will see that duration for RTSP live video is always 0. You can fix condition the way you want or even remove it alltogether if you wish so. In general, when dealing with such problems, comparing Java and Obj-C sources helps A LOT. Condition mentioned above is just not present on Android.

Ok, but I upload my binary app to App Store by EAS servers and I need the change on this repo please I don't like a forked. The onProgress works fine in some lives but no in others... :/

R4tch3t avatar Feb 25 '24 04:02 R4tch3t