liqvidjs / liqvid

Library for interactive videos in React
https://liqvidjs.org
MIT License
761 stars 39 forks source link

Is it possible to have a child playback? #35

Closed anishg-cn closed 1 year ago

anishg-cn commented 1 year ago

@ysulyma I have a query regarding one use case in my application. Is it possible to have a child playback inside a playback, so that when the child playback is playing the parent playback will be paused and when the child playback ends then the parent will play again?

If this is not present at the moment, can you please recommend a hack or something to achieve this?

ysulyma commented 1 year ago

@anishg-cn There is an attach() method planned, but I'm not sure it's what you want. With attach(), the child and parent would be playing simultaneously (e.g. the current <Audio> and <Video> will become special cases of attach()), rather than the parent stopping.

Does your use-case have separate scrubber bars for the child and parent? How will that work? I'd suggest using a timeupdate handler that checks whether parent.currentTime is between childStart and childEnd. Note: if the parent playback has audio that needs to resume, it may be impossible (try and see) to do this due to the Web Autoplay Policy.