Closed jonasmedeiros closed 8 years ago
Hi @gunsline2, you might want to try this:
var skylink = new Skylink();
skylink.setLogLevel(4);
skylink.on('peerJoined', function(peerId, peerInfo, isSelf) {
if(isSelf) return; // We already have a video element for our video and don't need to create a new one.
var vid = document.createElement('video');
vid.autoplay = true;
vid.muted = true; // Added to avoid feedback when testing locally
vid.id = peerId;
document.body.appendChild(vid);
});
skylink.on('incomingStream', function(peerId, stream, isSelf) {
if(isSelf) return;
var vid = document.getElementById(peerId);
if (vid) {
attachMediaStream(vid, stream);
}
});
skylink.on('peerLeft', function(peerId) {
var vid = document.getElementById(peerId);
if (vid) {
document.body.removeChild(vid);
}
});
skylink.on('mediaAccessSuccess', function(stream) {
var vid = document.getElementById('myvideo');
attachMediaStream(vid, stream);
});
skylink.init({
appKey: 'f6084524-d7a4-49b8-aed1-4a8732632ea5', // Get your own key at developer.temasys.com.sg
defaultRoom: "fouro_142"
}, function (error, success) {
if (error) {
document.getElementById('status').innerHTML = 'Failed retrieval for room information.<br>Error: ' + (error.error.message || error.error);
} else {
document.getElementById('status').innerHTML = 'Room information has been loaded. Room is ready for user to join.';
document.getElementById('start').style.display = 'block';
skylink.joinRoom({
audio: true,
video: true
}, function (error, success) {
if (error) {
document.getElementById('status').innerHTML = 'Failed joining room.<br>' +
'Error: ' + (error.error.message || error.error);
} else {
document.getElementById('status').innerHTML = 'Joined room.';
}
});
}
});
Because the workflow requires init()
to be invoked first but due to it being asynchronous, it has a callback which would return if result was successful or failed. The suggestion was to only invoke joinRoom()
after init()
was successful to ensure that init()
process was completed successfully before joining the room.
Hi @letchoo I made a code pain with it working and not check please http://codepen.io/gunsline/pen/BzBXVa (not working because of room )
http://codepen.io/gunsline/pen/RRbXJO ( working because changed the room )
cant be like this, at the middle conversation user cant talk anymore because something happen to the room, please check your server what is wrong with this case.
The code above was sent by you @letchoo that's I got it from that link.
I tried your code is not working look http://codepen.io/gunsline/pen/vKBoQM (not working case with room fouro_142)
Working room temp http://codepen.io/gunsline/pen/ezOqbG
Now you can check your server?
Hi @gunsline2,
Did you managed to test "Full Page View" ? I think you might have to verify your account. We could reproduce your codepen issue (fouro_142) and we are investigating on it.
Yes I have tested on my project your solution, as you saw at code pen is not working, I think the room have a limit of users, and for some reason is not cleaning the users and is getting full, after sometime it dont work, that might be a guess.
Hi @gunsline2, do you happen to have MCU enabled for your key? Btw we suggest to keep the environment for http://codepen.io/gunsline/pen/vKBoQM the same so our team can debug this issue.
hi @letchoo How do I do that?
Hi @gunsline2, to check if your key has enabled MCU, access your key and expand the "View Experimental Features". See if "Skylink Media Relay" is set to "ON". I would suggest setting it to "OFF" and see if it works for your environment.
Hi @letchoo Have done that not working check the image.
Hi @gunsline2, is your key f6084524-d7a4-49b8-aed1-4a8732632ea5
?
my key 'f6084524-d7a4-49b8-aed1-4a8732632ea5'
I have added codepen to my hosts so you can test there
Alright. We are investigating on how we can resolve this issue. Meanwhile, do you mind creating a new key (without "Skylink Media Relay" (MCU) turned "OFF"
).
Hi @gunsline2, do you have any open tab with that Key? If so, do you mind closing them so we can investigate this issue when using MCU.
I will make a new key with mcu turned off thanks for the help, let me know if you got the error, I might correct my code if it is doing something wrong.
I will update the project now with a new key, so you can test.
@gunsline2, thank you!
Just changed the key of the project, please @letchoo let me know if am doing something wrong at the project, it is an AngularJS project, I connect to the room by ajax, I had a problem that the peerjoined event was sending the same PeerId a lot of times, I resolved that making array of peers and check them, but I think that is the problem.
Hi @gunsline2, could you check if your ajax is giving you multiple responses. If you don't mind, we can take a look at your demo.
I will make an example and put it to heroku, might take some time.
Hi @letchoo studying a bit the code I checked that all on event on skylink at a javascrit project will duplicate each time it get to the room, that is why is calling 2 3 or more times.
Found this on your code SkylinkDemo.off("peerJoined"); commented
In my case I put the bellow code and now is not calling lot of times the events
skylink = new Skylink();
skylink.off('peerJoined');
skylink.off('incomingStream');
skylink.off('peerLeft');
skylink.off('incomingMessage');
skylink.off('peerUpdated');
skylink.off('mediaAccessSuccess');
skylink.off('iceConnectionState');
skylink.off('channelError');
skylink.off('mediaAccessError');
skylink.on('peerJoined', function(peerId, peerInfo, isSelf) {
if( isSelf ){ return };
Hi @gunsline2, yes it does as Skylink
class was mean to be initialised as an object once. I'm assuming that you create the Skylink
object on some ajax load? In the future, we will plan to make it to be able to instantiate multiple times in the future releases.
Does the connection work for you now currently?
@letchoo Im testing hope that was the problem, until now is working fine.
@letchoo You are correct, I use an AngularJS directive so it call an ajax to add the html, and there is a service where skylink is.
@gunsline2 our demo currently made mostly to works with one-time creation of the Skylink
object, but however we will look into it and make the relevant fixes for it for the future releases. It is in a plan.
Btw if this issue persists, please re-open this ticket. Since this issue (connection not working) has been resolved for you currently, I'll be closing this ticket. We will eventually look into some of the other issues listed (event handlers being called multiple times) or the connection issue with MCU (Skylink Media Relay) with the backend guys.
Please do reference ticket #232 for the multiple Skylink object instances.
@letchoo thanks for the support.
@gunsline2 welcomed
When I change the room name to test it works, what happen to that room, that is crashing the project, the user cant stream at this room, how can I clean it, or fixed? no error method is called, the client wants to contract you, but it should work fine.