views:

44

answers:

1

how can i add pause and play functionality to the code in this link? http://svay.com/experiences/mouse-recorder/

currently here you can play and stop only.

A: 

Just looking at the code..

There is a startRecord function

function startRecord(){
    setFPS();
    state = 2;
    disableAction();
    timer = window.setInterval('pushCoordinates()', Math.floor(1000/fps));
    document.getElementById('console').value = '';
    window.onmousemove = grabCoordinates;
}

and a stopRecord function:

function stopRecord(){
    window.clearInterval(timer);
    saveCoordonnees();
    state = 0;
    enableAction();
    document.getElementById('which').selectedIndex = 0;
}

You could probalby make a button with the that triggers pauseRecord and to something like

function pauseRecord(){
    //stop the timer
    window.clearInterval(timer);
}

and then one that triggers resumeRecord

function resumeRecord() {
    //start the timer again
    timer = window.setInterval('pushCoordinates()', Math.floor(1000/fps));
    window.onmousemove = grabCoordinates;
}
Drew LeSueur
thanks for the reply. But i was asking if i could add the pause and continue functionality to the playing of the mouse movements and not recording.
peter

related questions