Hello, I'm trying to display a remote streaming video but i succeed to connect to janus library but i get at the end a black screen instead of video content. Any idea about this issue please?
Am using the same library janus.mobile.js
In my Video component i call janusStart this way:
error: function(error) {
Janus.error('Janus -- ' + error);
Janus.error('Destroying Janus');
janus.destroy();
},
destroyed: function() {
Janus.log('Janus ' + name + ' -- ' + 'Janus session destroyed');
},
success: function() {
janus.attach({
plugin: 'janus.plugin.streaming',
success: function(pluginHandle) {
streaming = pluginHandle;
Janus.log(`Janus Plugin Attached : ${pluginHandle.getId()}`);
streaming.send({ message: { request: 'watch', id: this.state.id } });
},
error: function(error) {
Janus.error(`Error Attaching Janus Plugin ${error}`)
},
onmessage: function(msg, jsep) {
console.log("jsep" ,jsep.sdp);
Janus.log(`Janus Message received : ${JSON.stringify(msg)} and jsep ${jsep}`);
var result = msg['result'];
if (!!result && result['status'] == 'stopped') {
janus.destroy();
return;
}
if (jsep !== null && jsep !== undefined) {
Janus.log(`JANUS : Handling SDP as well : ${jsep}`);
streaming.createAnswer({
jsep: jsep,
media: { audioSend: false, videoSend: false }, // recvonly
success: function(jsep){
Janus.debug(`Janus Got SDP : ${jsep}`)
streaming.send({ message: { request: 'start' }, jsep: jsep });
},
error: function(error) {
Janus.error(`Janus WebRTC error : ${error}`)
}
});
}
},
onremotestream: function(stream) {
Janus.log('Janus Remote stream detected');
Janus.log(stream);
containerStreaming.setState({status: 'streaming', info: 'Streaming'});
containerStreaming.setState({selfViewSrc: stream.toURL()});
console.log("stream done")
},
oncleanup: function() {
Janus.log('Janus clean up notification')
}
})
}
});
}
})
};