I have created a HTML5 page with video element. A sample video is played. After I had tried to record the stream in the video element. I am using the RecordRTC library for recording functionality. I have the following code
var stream = document.getElementById("my_video").captureStream();
var recorder = RecordRTC(stream, {
type: 'video'
});
recorder.startRecording();
The recording is successfully working on Chrome browser and Mozilla browser till version 57. But in last January , Mozilla browser updated to version 58. After this update, I got error when trying to record video using Mozilla.
The error message is:
TypeError
message: document.getElementById("my_video").captureStream is not a function"
How to resolve this issue?
I have created a HTML5 page with video element. A sample video is played. After I had tried to record the stream in the video element. I am using the RecordRTC library for recording functionality. I have the following code
var stream = document.getElementById("my_video").captureStream();
var recorder = RecordRTC(stream, {
type: 'video'
});
recorder.startRecording();
The recording is successfully working on Chrome browser and Mozilla browser till version 57. But in last January , Mozilla browser updated to version 58. After this update, I got error when trying to record video using Mozilla.
The error message is:
TypeError
message: document.getElementById("my_video").captureStream is not a function"
How to resolve this issue?
Share Improve this question edited Feb 5, 2018 at 13:40 Tomasz Mularczyk 36.2k19 gold badges118 silver badges174 bronze badges asked Feb 5, 2018 at 13:10 Abdul ManafAbdul Manaf 5,00310 gold badges56 silver badges98 bronze badges 01 Answer
Reset to default 16Well, according to the docs this is experimental tech so Firefox requires you to prefix moz
to the function name: mozCaptureStream
. I'm a little surprised it worked at all previously.
You can check for the browser version with navigator.userAgent
.
const sUsrAg = navigator.userAgent;
if (sUsrAg.indexOf('Firefox') > -1) {
console.log('Firefox');
document.getElementById("my_video").mozCaptureStream();
} else {
console.log('Other');
document.getElementById("my_video").captureStream();
}
<video id="my_video"></video>