-
-
Notifications
You must be signed in to change notification settings - Fork 338
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
Datachannel Label in Janus.js #462
Comments
Yet another Janus related issue.... Last time was all streamId named "janus"...
@oscarvadillog Can you give me more details about the "crash in the janus.js" if you could give a sample script to reproduce. Note: Don't take my first phrase personaly, personaly I don't like of use Janus that why :) |
The issue is when receiving a message via the Datachannel and the janus.js tries to evaluate event.target.label var onDataChannelMessage = function(event) {
Janus.log('Received message on data channel:', event);
var label = event.target.label;
pluginHandle.ondata(event.data, label);
} @hthetiot please try to use the following script to reproduce the issue: (function() {
var script = document.createElement('script');
script.onload = function () {
var script = document.createElement('script');
script.onload = function () {
var server = "https://janus.conf.meetecho.com/janus";
var janus = null;
var echotest = null;
var opaqueId = "echotest-"+Janus.randomString(12);
Janus.init({debug: "all", callback: function() {
janus = new Janus(
{
server: server,
success: function() {
janus.attach(
{
plugin: "janus.plugin.echotest",
opaqueId: opaqueId,
success: function(pluginHandle) {
echotest = pluginHandle;
Janus.log("Plugin attached! (" + echotest.getPlugin() + ", id=" + echotest.getId() + ")");
// Negotiate WebRTC
var body = { "audio": true, "video": true };
echotest.send({"message": body});
Janus.debug("Trying a createOffer too (audio/video sendrecv)");
echotest.createOffer(
{
media: { data: true }, // Let's negotiate data channels as well
success: function(jsep) {
Janus.debug("Got SDP!");
Janus.debug(jsep);
echotest.send({"message": body, "jsep": jsep});
setInterval(function() {
echotest.data({
text: 'Sending msg via Datachannel...',
error: function(reason) { console.log(reason) },
success: function() {},
});
}, 5000);
},
error: function(error) {
Janus.error("WebRTC error:", error);
}
});
},
error: function(error) {
console.error(" -- Error attaching plugin...", error);
},
onmessage: function(msg, jsep) {
Janus.debug(" ::: Got a message :::");
Janus.debug(msg);
if(jsep !== undefined && jsep !== null) {
Janus.debug("Handling SDP as well...");
Janus.debug(jsep);
echotest.handleRemoteJsep({jsep: jsep});
}
var result = msg["result"];
if(result !== null && result !== undefined) {
if(result === "done") {
// The plugin closed the echo test
return;
}
}
},
onlocalstream: function(stream) {
Janus.debug(" ::: Got a local stream :::");
Janus.debug(stream);
},
onremotestream: function(stream) {
Janus.debug(" ::: Got a remote stream :::");
Janus.debug(stream);
},
ondataopen: function(data) {
Janus.log("The DataChannel is available!");
},
ondata: function(data) {
Janus.debug("We got data from the DataChannel! " + data);
},
oncleanup: function() {
Janus.log(" ::: Got a cleanup notification :::");
}
});
},
error: function(error) {
Janus.error(error);
}
});
}});
};
script.src = 'https://janus.conf.meetecho.com/janus.js';
document.head.appendChild(script);
};
script.src = 'https://cdnjs.cloudflare.com/ajax/libs/webrtc-adapter/6.4.0/adapter.min.js';
document.head.appendChild(script);
})(); |
Thank you @oscarvadillog I will look into it when I have a moment, there is other active member is the community that will may also looks into it. Keep you posted. |
@oscarvadillog Can you test this PR (see instructions) |
@oscarvadillog Will be released on 6.0.7 once you confirm the fix. |
It works like a charm - you rock @hthetiot ❤️ |
Observerd behavior
I'm using the plugin with the latest version of janus.js and I've detected a problem when receiving messages through the datachannel.
It seems that the data channel is opened properly and the plugin receives the messages, even the method emitReceivedMessage(...) is executed.
However, in janus.js we always expect to receive the label name of the datachannel (check here), and it seems that the plugin doesn't send it, so there is a crash in the janus.js file.
Do you think the plugin should send the label value or not? Must be something to fix at janus.js?
Platform information
The text was updated successfully, but these errors were encountered: