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
Add Streaming Video support with example #261
Add Streaming Video support with example #261
Conversation
…ed-scene video options
…ed-scene video options
…ault to avoid larsen effect
Thanks @hthetiot for this contribution. I looked at it quickly, the changes are really great and reflect the discussion we had here. I'll take a second look later to a do a proper review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This a great first implementation. Thank you for contributing it. I left some comments.
I'm wanting to discuss further the video option here and how we can use setLocalMediaStream.
From my understanding, the mic and camera tracks are set by the open-easyrtc library and the stream acceptor will call setMediaStream with a stream object containing the tracks. And we will have an audio or video track depending on enableMicrophone and enableCamera.
So I'm not sure if we can use setLocalMediaStream here like we do in janus adapter where we get the mic stream ourself and call setLocalMediaStream and this will change the stream sent by the publisher RTCPeerConnection, see https://github.com/Synantoo/naf-janus-adapter/blob/a3fbd137bebf3e4d34b4ba11a9ce91a6985cd477/examples/index.html#L126-L130 and https://github.com/Synantoo/naf-janus-adapter/blob/261e1ca6040b74c4b90ba62762e0847ab8b76761/src/index.js#L914
This let you create your own ui to list available microphones, get the mic stream with getUserMedia and an exact deviceId match. In janus adapter setLocalMediaStream is using replaceTrack on the stream of the publisher RTCPeerConnection.
In your implementation, setLocalMediaStream doesn't seem to change anything on the RTCPeerConnection, so it seems that if you select another mic and call setLocalMediaStream, it will still send the audio track selected by open-easyrtc. Am I wrong?
If we want to stream both camera and a screenshare, one need to call |
You can also add a link from index.html to your basic-video example. |
… enableAudio|enableVideo on enableMicrophone|enableCamera
done |
Multi stream is more complicated, we need change on Adapters interface for that. Let keep that for another PR dedicated to multi-stream. |
I would prefer to do that in separate PR, before or may be while doing multistream. |
No but enableCamera will, again that for multi-stream next PR, will also do multi-stream sample when i do that anyway. |
I'm fine with doing more complex stuff in another PR. In this case I think you should remove the setLocalMediaStream api from this PR is it doesn't do what I expect. |
Done, I will do the equivalent of setLocalMediaStream from janus using easyrtc in a separate PR later. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The latest changes are good.
I tried running the example right now, I didn't until now.
I configured a certificate in server/easyrtc-server.js
as documented in #257 and ran npm run dev
The basic-audio example works fine.
With your basic-video, I'm prompted for the camera permission, good, but I get the error in the console for Firefox
"MEDIA_ERR Failed to get access to local media. Error code was AbortError."
In Chrome I have no error, but in both browsers I don't see the element created for the other participant.
If now I set networked-scene="video:false", I see the white plane of the other participant. If now I call NAF.connection.adapter.enableCamera(true)
is does nothing, no error.
I'll test again tomorrow after a reboot, maybe there is something weird with my pc.
But in any case, can we make sure we still fully connect if there is an error getting the camera?
You don't have to push the dist folder in the PR. I'll take care of pushing an up to date dist folder after the merge. You can rebase your branch to remove those "build dist" commits if you want. The npm run dev
command take care of building dist/networked-aframe.js in memory via webpack-dev-middleware. And npm start
will build them on the filesystem (just fixed an issue with that on master after I merged the "remove browserify" PR, it seems I didn't retested properly the latest commit I did on that, sorry)
Nope, after a reboot I have the same issue I described. Is this working properly on your side? |
Occurs when another application use you camera on firefox. Works for me with Chrome and Firefox.
Will require to call initMedia again, enableCamera and enableMicrophone can be use to disable media stream not create media stream.
Ok noted.
I rather not please, merge and rebuild, next time i will not make dist.
I already use |
NO this is another feature. Trust me it's better to go step by steps. |
That not what Janus adapter does. Please dont ask again, i dont like when people want feature A and then ask B and C when its not in the same scope and A is already fulfilling #260 #211 #18 #190 scope. Feature PR need to be progressive the more you add the more you have risk of breaking and bug, beside setLocalMediaStream this match janus adapter. |
you need to provide what "networked-aframe" api will look like, you already want to remove audio: true, video: true You dont realize that multi stream will require negotiation and special code when the caller have more than one stream due WebRTC bugs, we will need to send the first stream, then once establish send the nexts ones and negotiate. Video is step one, then if you provide proper instruction for interface, like you did on #211 i may do more. But again mixing multi stream and video stream in one PR is a mistake, it better to iterate than making big PR that change everything for no good and have review that never ends. <3 |
I used |
Accessing the camera twice on the same PC was effectively my issue, thanks for pointing that out. :) In Chrome I got If in Firefox, I do I tested video:true on Chrome and then just consuming video on Firefox, it worked right away. I understand the multi streams videos is a complex subject. Here I was talking about screensharing in replacement of the camera, so not multistream, just one stream. But it seems you can't easily do that with open-easyrtc api, compared to setLocalMediaStream that the janus adapter api propose, noted. I'm good to merge that then. |
Yes, replacing stream is actualey a subset of multi-stream (Transceiver/Sender related). Still i can do It can be done with open-easyrtc today, my issue is more what the API will look like on networked-aframe to add a stream. may be it can simply be |
No it should only disable if sending one depending the browsers involved it may freeze, get black or blank. |
networked-scene
video options from component elementenableVideo
argument toconnect
method inNetworkConnection
EasyRtcAdapter
video support andsetLocalMediaStream
andenableMicrophone
like Janus Adapter.basic-video
exampleNote: Camera from OBS Virtual Camera in screenshot.