====== 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 [[ixnx:wrtc:js:api:wrtc:setcapturedevice|wrtc.setCaptureDevice()]]. wrtc.changeMedia() is also used to get access to camera and microphone outside of calls. To change microphone set [[ixnx:wrtc:js:api:wrtc:audiosource|wrtc.audioSource]] to the unique ID of the microphone to use before calling wrtc.changeMedia(). To change camera either set [[ixnx:wrtc:js:api:wrtc:videosource|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 [[ixnx:wrtc:js:api:wrtc:get|wrtc.get("audioSources")]] and [[ixnx:wrtc:js:api:wrtc:get|wrtc.get("videoSources")]], respectively. To start screen sharing use [[ixnx:wrtc:js:api:wrtc:getscreen|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 [[https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamConstraints|mediaConstraints]] If argument is missing value of [[ixnx:wrtc:js:api:wrtc:videosource|wrtc.videoSource]] will be used. \\ If argument was supplied value of [[ixnx:wrtc:js:api:wrtc:videosource|wrtc.videoSource]] will be set to that value. ===== Returns ===== Nothing. ===== Events ===== [[ixnx:wrtc:js:api:wrtc:onlocalmedia|wrtc.onLocalMedia()]] ===== See also ===== [[ixnx:wrtc:js:api:wrtc:setcapturedevice|wrtc.setCaptureDevice()]]