Closed maxcurzi closed 3 months ago
I actually got this working with storing the audio content in memory and replaying with a byte cursor, and the video replay was with a flag, easy enough:
video.set(opencv::videoio::CAP_PROP_POS_AVI_RATIO, 0.0);
See my change here: https://github.com/maxcurzi/tplay/compare/main...december1981:tplay:support-playback-loop?expand=1
I just used an argument "loops" to enable or not. The default behaviour of animated gifs was to loop, so I stopped that unless the loops argument was used, for consistency.
I used loops
, and not loop
by the way, because otherwise it's r#loop
in code...
I should add, I only played around with the audio loop for rodio.
Looks great. I tested it and it works like a charm! @december1981 I created a pull request after making just a couple of tweaks. Have a look if you'd like at https://github.com/maxcurzi/tplay/pull/38 (not sure why I can't tag you directly on the PR)
Describe the solution you'd like Allow looping of videos, rather than stopping at the end.
Additional context
Ideally the loop can be enabled via command line flag (--loop, -l )
A "keypress" to enable loop could also be considered, but at the moment the is no way of visualizing playback status to it may be confusing/not intuitive.
Not straightforward to implement (we can't just "seek(0)", videos and audio are played independently. A simple solution could be re-open and re-start playback of video/audio on stream end. Should we keep the same threads alive, or should we spawn new threads when playback ends (at a higher level).