This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Customized code to allow WebRTC record on existing page or HTML5 video blob download (based on https://github.com/webrtc/samples/blob/409d5631f38f2bdc4dafb5275d1bc77738fbb1ba/src/content/getusermedia/record/js/main.js) | |
* Recording will start when executing this script and you will have to execute manually startDownload() function when needed in web console with or without stopRecording() | |
* Recording should ideally start before playing video manually and in case controls are hidden, you can record from the start with a command like document.getElementsByTagName("video")[0].currentTime = 0 | |
* By default, the script targets the first video element document.getElementsByTagName("video")[0] but you can change the code if needed. | |
*/ | |
// If there is an error due to DRM, capture the stream by executing the following 2 lines before playing / loading the video: | |
var video = document.getElementsByTagName("video")[0]; | |
var stream = video.captureStream ? video.captureStream() : video.mozCaptureStream(); |