P5JS cueing video media elements

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

Sign In or Register to comment.