razorRun/react-native-vlc-media-player

onProgress not working on IOS

yedi97 opened this issue · 12 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!

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

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

yedi97 commented

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

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

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.

yedi97 commented

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

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... :/