Hello everyone,
I have spent some time learning Lua in the VLC environment and wrote an extension called Resume Media V2, which is listed in the Addons Extensions page. The extension fairly successfully detects a stopped video, stores the positions in a table and then resumes the video when it restarts.
I have been able to blindly use meta_changed calls to detect a video stop or start event. For a video (mp4's), there is a flurry of calls when it starts playing, and a few when it stops. So, I just grab the first one and ignore the rest for a short period. This has worked for videos.
I noticed with (at least) audio mp3's that there is often a continuous series of calls to meta_changed every second or so while the audio is playing. Without a way to determine the reason for the calls, I am forced to respond to them in case one is a stop event and I would need to save the position.
Is there any way to differentiate the calls to meta_changed? Specifically, I want to know if the user pushed the stop button. The input.is_playing flag seems to always be true when meta_changed is called and input_changed is not triggered for a stop event.
I am considering saving the audio position every 15 seconds or so while the media is playing instead of saving for each call to meta_changed. Ideally, I only want to save when the media stops or changes or VLC closes.
I could wait until the series of calls to meta_changed stops, but without a timer there would then be no automatic callback to regain control and save the last position.
Thanks for your help!!
Rocky