We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I cannot remove cues on video media elements and they stay around and mess up the ongoing behaviour of the code
Here's some code
/* * @name Video * @frame 710,250 * @description
<
p>Load a video with multiple formats and toggle between playing * and paused with a button press. *
To run this example locally, you will need at least * one video file, and the * p5.dom library.
*/ var playing = false; var fingers; var button; var a_cue;
function setup() { // specify multiple formats for different browsers fingers = createVideo(['assets/fingers.mov', 'assets/fingers.webm']); button = createButton('play'); button.mousePressed(toggleVid); // attach button listener a_cue = fingers.addCue( 2, cued, fingers); }
function cued( a) { console.info(' cued a.time:'+a.time()); a.removeCue( a_cue); a.clearCues(); } // plays or pauses the video depending on current state function toggleVid() { if (playing) { fingers.pause(); button.html('play'); } else { fingers.loop(); button.html('pause'); } playing = !playing; }
I would expect the call to the cued() callback to remove the cue and to prevent further calls into the c/b
Ultimately what I'm trying to do is to coordinate the parallel playback of two video streams and to use cuing to control the crossovers between
Answers
I did get this working , after a fashion https://goo.gl/X79nGx
Thank you for sharing your solution! I hope one of our p5.js experts may have a comment or feedback -- in what way did you only get it working "after a fashion"?
Only in the sense that removecues didn't seem to work (as per OP) so I reverted to smashing the _cues member variable to []
@aldobranti -- Interesting. I see that you reported it, and a fix was filed and the issue closed. Did the fix not work for you? Maybe you should report back on that issue if the fix didn't work....