WebRTC-Experiment
WebRTC-Experiment copied to clipboard
Auto record a tab.
Is there a way to auto record a tab without the users intervention.
We would like to make sure a tab is always recorded and not rely on user input.
If you want to auto record then you can use recordRTC when your connection is established. for example:
var connection = new RTCMultiConnection();
var video = document.querySelector('#video')
// this line is VERY_important
connection.socketURL = 'https://rtcmulticonnection.herokuapp.com:443/';
// if you want audio+video conferencing
connection.session = {
audio: true,
video: true,
oneway: true
};
connection.mediaConstraints = {
video: true,
audio: true
};
connection.open('coach-stream')
connection.sdpConstraints.mandatory = {
OfferToReceiveAudio: false,
OfferToReceiveVideo: false
};
connection.onstream=function(event){
if( event.type === 'local' ){
video.addEventListener("pause", function(){
connection.streamEvents.selectFirst({local: true}).stream.mute();
});
video.addEventListener("play", function(){
connection.streamEvents.selectFirst({local: true}).stream.unmute();
});
}
video.srcObject = event.stream
var recorder = RecordRTC(event.stream, {type:'video'})
recorder.startRecording();
hope this helps.