amazon-ivs-react-native-player icon indicating copy to clipboard operation
amazon-ivs-react-native-player copied to clipboard

How to play repeating after a video ended playing

Open dreamrsio opened this issue 2 years ago • 5 comments

How can we enable a video to play again from start after end playing

dreamrsio avatar Sep 21 '22 20:09 dreamrsio

  const onPlayerStateChange = useCallback(
    (onPlayerStateChange) => {
      if (onPlayerStateChange === 'Ended') {
        playerRef.current?.play();
      }
    },
    []
  );

But I would find a loop prop more convenient too

hirbod avatar Sep 21 '22 23:09 hirbod

Hi all, thanks for the feedback. We don’t have a loop prop currently, but I will leave this open for others to +1.

maxstoller avatar Sep 23 '22 17:09 maxstoller

Hey @maxstoller, what should be the ideal way to play videos in loop?

dmahajan980 avatar Jan 04 '23 18:01 dmahajan980

Hi @dmahajan980, the code snippet @hirbod provided above should work.

maxstoller avatar Jan 09 '23 18:01 maxstoller

Hi @dreamrsio we now have support for loop

https://github.com/aws/amazon-ivs-react-native-player/blob/main/docs/ivs-player-reference.md#loop-optional

dawhitla avatar Aug 09 '23 21:08 dawhitla