videoroom plugin: attaching MediaStream to video element

500 views
Skip to first unread message

Peter Friend

unread,
Aug 31, 2016, 8:46:22 AM8/31/16
to meetecho-janus
Hey guys,

firstly thanks for the superb work on this project and taking the time for support.

My question is about the videoroom plugin, specifically attaching a stream object obtained from the onremotestream callback to a video element. Our api receives events from janus via the "Event Handler API" that you set up. 

Every time there's a new publisher in the room this event gets forwarded to the user that would like to connect to it. 
Once the feedId has been forwarded to the user I attach a new plugin (basically copied from the "newRemoteFeed" function inside videoroomtest.js). 
Then in the onremotestream callback I'm trying to attach the MediaStream object (via adapter.js attachMediaStream) to a newly created video element after appending it to the DOM. I received the message "Successfully attached to feed x in room x" and I also get "Janus says this WebRTC PeerConnection is up" however the stream doesn't show up. It's just a blank video element.

Below is a link to the code I'm using to attach the plugin and attach the stream to the element

Do you have any idea why this could be happening?


Thank you very much in advance and have a nice day :)

Peter

Lorenzo Miniero

unread,
Aug 31, 2016, 8:53:05 AM8/31/16
to meetecho-janus
Your onremotestream callback stream does nothing, that's where you should attach the stream to the video element. Check the demos to see how to do that.

L.

Peter Friend

unread,
Aug 31, 2016, 8:57:46 AM8/31/16
to meetecho-janus
Hi Lorenzo,

sorry if it wasn't clear. Inside the callback function I call my own callback function and pass the stream object. My callback function is also shown in the code below.

Lorenzo Miniero

unread,
Aug 31, 2016, 9:07:36 AM8/31/16
to meetecho-janus
Then something's wrong in either the callback (maybe it's not called for some reason?) or the helper code. I think the video element must exist before you set the stream on it, I see you're appending it only later. Not sure if that can affect things.

L.
Reply all
Reply to author
Forward
0 new messages