Jump to content

webRTC support for VideoTexture


hunts
 Share

Recommended Posts

I think you should modify CreateFromWebCam function and add to navigator.getUserMedia ID of your cam

https://github.com/BabylonJS/Babylon.js/blob/5dfa40ab8ccfb1ea31af53f72b5e4f66de8c759e/src/Materials/Textures/babylon.videoTexture.ts#L98

if (navigator.getUserMedia) {
			    navigator.getUserMedia({ 

                    video: {
                        deviceId: {exact: VIDEO_SOURCE}, // <<<<<<<<<<<
                        width: {
                            min: (constraints && constraints.minWidth) || 256,
...

replace VIDEO_SOURCE with your camera ID. You can get devices list using navigator.mediaDevices.enumerateDevices function

Link to comment
Share on other sites

15 hours ago, Deltakosh said:

This should work directly. (It works for me on CHrome and Firefox). Do you have any error on the console?

it's run the FRONT camera default on android in chrome for me, and to switch to another camera - video device ID must be added to getUserMedia constraints, but `CreateFromWebCam` does not have this param

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...