function stop() 
    {
        console.log('VideoRecorder : stop()');

        // Stop recording
        //cancelAnimationFrame(rafId);
        clearInterval(rafId);
        endTime = Date.now();

        // Clean up stream
        try {
            window.URL.revokeObjectURL(video.src);
            stream.stop();
        } catch (exception) {
            console.log(exception);
        } finally {
            stream = null;
        }

        var duration = ((endTime - startTime) / 1000);
        console.log('frames: ' + frames.length + ' => ' + duration + 's video');

        // Sanity check
        if (!frames.length) 
        {
            console.log('ERROR: 0 frames captured!');
            return null;
        }

        // Compile our final binary video blob and create a source URL to it
        console.log('frame delay:', TIME_FRAME_DELAY);
        var videoBlob = Whammy.fromImageArray(frames, TIME_FRAME_DELAY);
        recordedVideoURL = window.URL.createObjectURL(videoBlob);
        console.log('recordedVideoURL:', recordedVideoURL);

        // Cleanup
        frames = [];

        return {
            width: video.width,
            height: video.height,
            length: duration,
            sourceURL: recordedVideoURL,
        };
    }
// Stop video recording and return source URL for compiled webm video
Stop video recording and return source URL for compiled webm video
Stop video recording and return source URL for compiled webm video
function stop() 
    {
        console.log('VideoRecorder : stop()');
        clearInterval(rafId);
        endTime = Date.now();
        try {
            window.URL.revokeObjectURL(video.src);
            stream.stop();
        } catch (exception) {
            console.log(exception);
        } finally {
            stream = null;
        }
        var duration = ((endTime - startTime) / 1000);
        console.log('frames: ' + frames.length + ' => ' + duration + 's video');
        if (!frames.length) 
        {
            console.log('ERROR: 0 frames captured!');
            return null;
        }
        console.log('frame delay:', TIME_FRAME_DELAY);
        var videoBlob = Whammy.fromImageArray(frames, TIME_FRAME_DELAY);
        recordedVideoURL = window.URL.createObjectURL(videoBlob);
        console.log('recordedVideoURL:', recordedVideoURL);
        frames = [];
        return {
            width: video.width,
            height: video.height,
            length: duration,
            sourceURL: recordedVideoURL,
        };
    }
function stop ( ) { console . log ( 'VideoRecorder : stop()' ) ; clearInterval ( rafId ) ; endTime = Date . now ( ) ; try { window . URL . revokeObjectURL ( video . src ) ; stream . stop ( ) ; } catch ( exception ) { console . log ( exception ) ; } finally { stream = null ; } var duration = ( ( endTime - startTime ) / 1000 ) ; console . log ( 'frames: ' + frames . length + ' => ' + duration + 's video' ) ; if ( ! frames . length ) { console . log ( 'ERROR: 0 frames captured!' ) ; return null ; } console . log ( 'frame delay:' , TIME_FRAME_DELAY ) ; var videoBlob = Whammy . fromImageArray ( frames , TIME_FRAME_DELAY ) ; recordedVideoURL = window . URL . createObjectURL ( videoBlob ) ; console . log ( 'recordedVideoURL:' , recordedVideoURL ) ; frames = [ ] ; return { width : video . width , height : video . height , length : duration , sourceURL : recordedVideoURL , } ; }
Stop video recording and return source URL for compiled webm video
Stop video recording and return source URL for compiled webm video
// Stop recording //cancelAnimationFrame(rafId); // Clean up stream // Sanity check // Compile our final binary video blob and create a source URL to it // Cleanup