Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

scope.audioContext.createMediaElementSource is not a function #6

Open
crisari666 opened this issue Jul 10, 2019 · 2 comments
Open

scope.audioContext.createMediaElementSource is not a function #6

crisari666 opened this issue Jul 10, 2019 · 2 comments

Comments

@crisari666
Copy link

I am getting following:
I downloaded: dist/SFMediaStream.js and change name to SFMediaStreamer.js
Error Console
image
image

[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();
    })
}
@crisari666
Copy link
Author

function line error
image

@StefansArya
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants