SFMediaStream
SFMediaStream copied to clipboard
scope.audioContext.createMediaElementSource is not a function
I am getting following:
I downloaded: dist/SFMediaStream.js and change name to SFMediaStreamer.js
Error Console
[Code por copy or edit] var video = document.querySelector('#video1'); var video2 = document.querySelector('#video2'); var socket; var chunks = []; var ms = new MediaSource(); var uno = false; $(()=>{ socket = io.connect( "https://host3.virtualsoccergroups.com:3010", {transports: [ 'websocket' ], upgrade:false} ); socketC(); setTimeout(()=>{ socket.disconnect(); }, 50000); // receiveVideo(); }); function socketC(){ socket.on('connect',function(){ console.log('socket on') }); }
var videoStreamer = new ScarletsVideoStreamer(video, 1000); // 1sec
// videoStreamer.playStream();
// First thing that must be received
socket.on('bufferHeader', function(packet){
console.log('bufferHeader',packet);
videoStreamer.setBufferHeader(packet);
});
socket.on('stream', function(packet){
console.log("Buffer received: " , packet);
videoStreamer.receiveBuffer(packet);
});
// Add an effect
var ppDelay = ScarletsMediaEffect.pingPongDelay();
// Stream (source) -> Ping pong delay -> destination
videoStreamer.audioConnect(ppDelay.input);
ppDelay.output.connect(ScarletsMedia.audioContext.destination);
function download(blob) {
var link = document.createElement('a');
link.setAttribute('download', 'video.webm');
link.setAttribute('href', URL.createObjectURL(blob));
link.style.display = "none";
// NOTE: We need to add temporarily the link to the DOM so
// we can trigger a 'click' on it.
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
}
function btnAction(){
$('#btnPlay').click(function(){
video.play();
})
}
function line error
Hi, looks like it was initialized before any user interaction in the web page. Some of mobile browser may need user interaction before being able to start/listening the audio.
But I think there's a way to fix it, try it again with v.1.1.0