Ant-Media-Server icon indicating copy to clipboard operation
Ant-Media-Server copied to clipboard

Self-camera switching

Open wonjangcloud9 opened this issue 3 years ago • 8 comments

Is your feature request related to a problem? Please describe.

Self-camera switching in webRTC between mobile and mobile does not apply as a traditional function.

Describe the solution you'd like

The camera must be able to change back and forth between the mobile and the WebRTC call.

Describe alternatives you've considered

Function added to existing available webrtc_adaptor.js.

async switchCameras(streamId, camera) { this.localStream.getVideoTracks().forEach(function (track) { track.stop(); }); const resolution = { facingMode: camera, } const mediaConstraints = { video: resolution, audio: true, }; const stream = await navigator.mediaDevices.getUserMedia(mediaConstraints); this.updateVideoTrack(stream, streamId, this.mediaConstraints, onended, null); }

Additional context

I've been lost for a week in relation to the above case. I hope it helps someone who needs to change the screen while making a webRTC call.

wonjangcloud9 avatar Jun 28 '22 09:06 wonjangcloud9

Thank you @wonjangcloud9 for your contribution. It's very kind of you thinking of helping guys in the community.
We just would like to show our appreciation with a small gift by sending a starbucks card to let you have coffee from Ant Media.

Just a reminder, there is a method(switchVideoCameraCapture) that can be used with available_devices callback to switch the cameras

webRTCAdaptor.switchVideoCameraCapture(streamId, deviceId);

You can see how it's used in this sample -> https://github.com/ant-media/StreamApp/blob/master/src/main/webapp/index.html

mekya avatar Jul 04 '22 17:07 mekya

I thought of the self-camera switching mode provided by the basic camera application in an environment where both are smartphones.

You might misunderstand because it's always video: {facingMode: "user"} on the desktop.

What I thought of was a transition between video: {facingMode: "environment"} and video: {facingMode: "user"}.

Next time, I'll try to write more clearly.

Thank you for your answer and I hope you are always happy.

wonjangcloud9 avatar Jul 04 '22 22:07 wonjangcloud9

I see the point. I think we can add this method to the SDK as well.

Thank you for your contribution @wonjangcloud9

mekya avatar Jul 06 '22 11:07 mekya

I love u!!!!

wonjangcloud9 avatar Jul 06 '22 11:07 wonjangcloud9

We love you back :)

Let us send you a starbucks gift card to have remote coffee together :)
If it's ok, what's your email address? You can send your email to me through [email protected]

mekya avatar Jul 06 '22 11:07 mekya

I sent the email you told me.

Thank you for making my day special.

I wish you all the best!

wonjangcloud9 avatar Jul 06 '22 13:07 wonjangcloud9

Thank you. I've received and we'll send you the starbucks gift card shortly.

Wish you the best.

mekya avatar Jul 07 '22 05:07 mekya

I hope you've received your card. Btw, I'm enjoying my coffee. Cheers :)

IMG_6330

mekya avatar Jul 07 '22 11:07 mekya