Search code examples
iosreactjsreact-nativereact-native-video

react-native-video auto repeat issue on IOS


I am developing react native app that show video. I have used react-native-video package. When the video page open, the video will auto start for once and should not repeat after the video end. It works well on android but on IOS the video auto start again from the beginning and keep repeating. This is my code to stop video after the video end:

  const onEnd = () => {
   setState({ ...state, play: false, showControls: true });
   if (videoRef.current) {
     videoRef.current.seek(0);
   }
  };

How I can solve this issue?


Solution

  • I solved it by removing this line of my code. Keep current video time at maximum duration and don't set to 0, it will make infinite repeat condition.

    if (videoRef.current) {
     videoRef.current.seek(0);
    }