{"id":4535,"date":"2021-11-26T20:44:49","date_gmt":"2021-11-26T12:44:49","guid":{"rendered":"https:\/\/www.enablex.io\/developer\/?page_id=4535"},"modified":"2025-02-20T17:18:52","modified_gmt":"2025-02-20T09:18:52","slug":"switch-camera-mic-speaker","status":"publish","type":"page","link":"https:\/\/doc.smartflomeet.ttns.in\/developer\/video-api\/client-api\/react-native-toolkit\/switch-camera-mic-speaker\/","title":{"rendered":"Switch Camera, Microphone &#038; Speaker: React Native SDK &#8211; Video API"},"content":{"rendered":"\n<p>A user may want to switch to alternate Media Devices for his published stream. Portal API allows Media Device switching on the fly.  <\/p>\n\n\n\n<h4>Table of Contents<\/h4>\n\n\n\n<ul><li><a href=\"#switch-camera\">Switch between Rear &amp; Front Camera<\/a><\/li><li><a href=\"#switch-mic\">Switch to alternate Microphone<\/a>  <\/li><\/ul>\n\n\n\n<p>The APIs allows you to switch between Rear and Front Camera and to alternate available Microphone. <\/p>\n\n\n\n<div style=\"height:20px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<a name=\"switch-camera\"><\/a>\n\n\n\n<div style=\"height:20px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3>Switch between Rear &amp; Front Camera<\/h3>\n\n\n\n<p>If user looks to switch between Rear and Front Camera as a source for published Stream, use <code>Enx.switchCamera()<\/code> method. <\/p>\n\n\n\n<p> <strong>Method: <\/strong><code>Enx.switchCamera(localStreamId)<\/code> <\/p>\n\n\n\n<p><strong>Parameters: <\/strong> <code>localStreamId<\/code> &#8211; String, Local Stream Id whose source camera is being switched<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">Enx.switchCamera(localStreamId);<\/pre>\n\n\n\n<a name=\"switch-mic\"><\/a>\n\n\n\n<div style=\"height:40px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3>Switch to alternate Microphone<\/h3>\n\n\n\n<p> If user looks to switch Micrcophone used to create published Stream to an alternate Microphone, use <code>Enx.switchMediaDevice()<\/code> method.  This API requires new device name to switch to. You can use <a href=\"..\/get-devices\/\"><code>Enx.getDevices()<\/code><\/a> method to fetch a list of microphone names and create a UI for new device selection.<\/p>\n\n\n\n<p><strong>Method: <\/strong><code>Enx.switchMediaDevice(micDevice)<\/code><\/p>\n\n\n\n<p><strong>Parameters: <\/strong> <code>micDevice <\/code>&#8211; String, New Microphone Device name<\/p>\n\n\n\n<p><strong>Callback: <\/strong> <code>notifyDeviceUpdate <\/code>&#8211; When Audio Device Update is complete. Returns with switched Microphone Device<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">Enx.switchMediaDevice( micDevice ); \/\/ To switch to new micDev\n\n\/\/ To self: Device updated\nnotifyDeviceUpdate : event =&gt;{\n\t\/\/ event = micDevice name\n} <\/pre>\n\n\n\n<div style=\"height:40px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<hr class=\"wp-block-separator is-style-wide\"\/>\n\n\n\n<div class=\"wp-block-columns\">\n<div class=\"wp-block-column\">\n<p>\u2190 <a href=\"..\/publishing-local-stream\/\">Publish Local Stream<\/a><\/p>\n<\/div>\n\n\n\n<div class=\"wp-block-column\">\n<p class=\"has-text-align-center\"><a href=\"..\/\">Index<\/a><\/p>\n<\/div>\n\n\n\n<div class=\"wp-block-column\">\n<p class=\"has-text-align-right\"><a href=\"..\/mute-audio-video-stream\/\">Mute-Unmute Audio Video<\/a> \u2192<a href=\"\/developer\/how-to-use\/\"><\/a><\/p>\n<\/div>\n<\/div>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>A user may want to switch to alternate Media Devices for his published stream. Portal API allows Media Device switching on the fly. Table of Contents Switch between Rear &amp; Front Camera Switch to alternate Microphone The APIs allows you to switch between Rear and Front Camera and to alternate available Microphone. Switch between Rear &amp; Front Camera If user looks to switch between Rear and Front Camera as a&hellip; <\/p>\n","protected":false},"author":1,"featured_media":0,"parent":3747,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"ub_ctt_via":""},"featured_image_src":null,"uagb_featured_image_src":{"full":false,"thumbnail":false,"medium":false,"medium_large":false,"large":false,"1536x1536":false,"2048x2048":false,"featured":false,"featured-large":false},"uagb_author_info":{"display_name":"vcxdevwpadmin","author_link":"https:\/\/doc.smartflomeet.ttns.in\/developer\/author\/vcxdevwpadmin\/"},"uagb_comment_info":0,"uagb_excerpt":"A user may want to switch to alternate Media Devices for his published stream. Portal API allows Media Device switching on the fly. Table of Contents Switch between Rear &amp; Front Camera Switch to alternate Microphone The APIs allows you to switch between Rear and Front Camera and to alternate available Microphone. Switch between Rear&hellip;","_links":{"self":[{"href":"https:\/\/doc.smartflomeet.ttns.in\/developer\/wp-json\/wp\/v2\/pages\/4535"}],"collection":[{"href":"https:\/\/doc.smartflomeet.ttns.in\/developer\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/doc.smartflomeet.ttns.in\/developer\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/doc.smartflomeet.ttns.in\/developer\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/doc.smartflomeet.ttns.in\/developer\/wp-json\/wp\/v2\/comments?post=4535"}],"version-history":[{"count":0,"href":"https:\/\/doc.smartflomeet.ttns.in\/developer\/wp-json\/wp\/v2\/pages\/4535\/revisions"}],"up":[{"embeddable":true,"href":"https:\/\/doc.smartflomeet.ttns.in\/developer\/wp-json\/wp\/v2\/pages\/3747"}],"wp:attachment":[{"href":"https:\/\/doc.smartflomeet.ttns.in\/developer\/wp-json\/wp\/v2\/media?parent=4535"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}