Video Component -> on finish, play next video in playlist (Running into issues)

#1

Hi, I am trying to create a playlist component, which has a this.state.playlist consisting of multiple mp4 video files, and the source of the Video tag is this.state.playlist[0]. Ideally when one video finishes, this.state.playlist shifts the first component and pushes it to the back, effectively moving onto the next component. However, it seems like the next video is starting at the same time the first video ends.

So for instance: if I have video A ( 1 min and 10 seconds) , video B (1 min and 40 seconds), and video C (2 minutes and ten seconds) . In this example, video A will play as normal, video B will start at 1 min and 10 seconds, and video C will start at 1 minute and 40 seconds. Here is an example expo.snack:

https://snack.expo.io/By7nzgmtW

You can imagine this is especially an issue when it comes to videos that are the same amount of time as it seemingly just skips over them in general (this has been happening to me and I’ve been struggling the past couple days trying to figure out why the player seems to be skipping over some videos).

Also note: in my own code for my full repo (I would share it but its quite lengthy and I think the above snack is much more illustrative of the issue) I use the require syntax because the video files are local, so let me know if theres any differences between the require/uri syntax in your solutions please.

Also, If you’re going to link me to the docs and a specific portion I would highly appreciate an example snack using my code, as I’ve read through the docs for the AV/Video stuff quite a few times and haven’t figured out a solution.

Thank you.

0 Likes