changeMedia()

wrtc.changeMedia() changes local media sources (camera and microphone to be used). Used eg in mobile phones to switch between back and front camera. Identical duplicate of wrtc.setCaptureDevice().

wrtc.changeMedia() is also used to get access to camera and microphone outside of calls.

To change microphone set wrtc.audioSource to the unique ID of the microphone to use before calling wrtc.changeMedia().

To change camera either set wrtc.videoSource to the unique ID of the camera to use before calling wrtc.changeMedia() or supply the unique camera ID as argument to wrtc.changeMedia().

To get list of available microphones and cameras use wrtc.get("audioSources") and wrtc.get("videoSources"), respectively.

To start screen sharing use wrtc.getScreen() instead.

Arguments

videoSource - (optional):

  • string containing unique camera ID to use
  • 0 if system's default camera is to be used
  • "user" - forward facing "selfie" camera on mobile phones
  • "environment" - back side main camera on mobile phones
  • null to turn off local camera
  • (advanced) JSON structure containing complete mediaConstraints

If argument is missing value of wrtc.videoSource will be used.
If argument was supplied value of wrtc.videoSource will be set to that value.

Returns

Nothing.

Events

See also

ixnx/wrtc/js/api/wrtc/changemedia.txt · Last modified: by tibor
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0