{"id":4207,"date":"2021-11-11T15:25:53","date_gmt":"2021-11-11T07:25:53","guid":{"rendered":"https:\/\/www.enablex.io\/developer\/?page_id=4207"},"modified":"2022-04-08T18:20:45","modified_gmt":"2022-04-08T10:20:45","slug":"switch-camera-mic-speaker","status":"publish","type":"page","link":"https:\/\/doc.smartflomeet.ttns.in\/developer\/video-api\/client-api\/android-toolkit\/switch-camera-mic-speaker\/","title":{"rendered":"Switch Camera, Microphone &#038; Speaker: Android SDK &#8211; Video API"},"content":{"rendered":"\n<p>The following APIs allow you to switch to alternate Media Devices after having published Stream, thus facilitating a switch 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<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>The <code>EnxStream.switchCamera()<\/code> method allows you to switch between Rear and Front Camera as a source for the published Stream.<\/p>\n\n\n\n<p> <strong>Class: <\/strong><code>EnxStream<\/code> <\/p>\n\n\n\n<p> <strong>Method: <\/strong><code>public void switchCamera()<\/code> &#8211; No parameter required. <\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">localStream.switchCamera();<\/pre>\n\n\n\n<p><strong>Error Codes \/ Exceptions<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Code<\/th><th>Description<\/th><\/tr><\/thead><tbody><tr><td>5021<\/td><td>Unable to switch Camera in Audio-only call mode.<\/td><\/tr><tr><td>5097<\/td><td>Unable to switch Camera in a Chat-Only Room. Non-Contextual Method Call. <\/td><\/tr><\/tbody><\/table><\/figure>\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>The <code>EnxRoom.switchMediaDevice()<\/code> method is used to switch the Audio source of the published Stream to an alternate Microphone. This method requires ID of the Audio device to switch to, which needs to be retrieved using <a href=\"..\/get-devices\/\"><code>EnxRoom.getDevices()<\/code><\/a> method. <\/p>\n\n\n\n<p><strong>Class: <\/strong><code>EnxRoom<\/code><\/p>\n\n\n\n<p><strong>Method: <\/strong><code>public void switchMediaDevice(String micDeviceId)<\/code><\/p>\n\n\n\n<p><strong>Parameters: <\/strong> <code>micDeviceId <\/code>&#8211; String. Target Microphone Device ID.<\/p>\n\n\n\n<p><strong>Observer: <\/strong> <code>onNotifyDeviceUpdate <\/code>&#8211; Acknowledgment sent with the new Audio Device ID after Audio Device update is complete.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">room.switchMediaDevice( micDeviceId );\n\npublic void onNotifyDeviceUpdate( String micDeviceId ) {\n      \/\/ Switched to micDeviceId\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=\"\/developer\/video-api\/client-api\/web-toolkit\/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>The following APIs allow you to switch to alternate Media Devices after having published Stream, thus facilitating a switch on the fly. Table of Contents Switch between Rear &amp; Front Camera Switch to alternate Microphone Switch between Rear &amp; Front Camera The EnxStream.switchCamera() method allows you to switch between Rear and Front Camera as a source for the published Stream. Class: EnxStream Method: public void switchCamera() &#8211; No parameter required.&hellip; <\/p>\n","protected":false},"author":1,"featured_media":0,"parent":3740,"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":"The following APIs allow you to switch to alternate Media Devices after having published Stream, thus facilitating a switch on the fly. Table of Contents Switch between Rear &amp; Front Camera Switch to alternate Microphone Switch between Rear &amp; Front Camera The EnxStream.switchCamera() method allows you to switch between Rear and Front Camera as a&hellip;","_links":{"self":[{"href":"https:\/\/doc.smartflomeet.ttns.in\/developer\/wp-json\/wp\/v2\/pages\/4207"}],"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=4207"}],"version-history":[{"count":0,"href":"https:\/\/doc.smartflomeet.ttns.in\/developer\/wp-json\/wp\/v2\/pages\/4207\/revisions"}],"up":[{"embeddable":true,"href":"https:\/\/doc.smartflomeet.ttns.in\/developer\/wp-json\/wp\/v2\/pages\/3740"}],"wp:attachment":[{"href":"https:\/\/doc.smartflomeet.ttns.in\/developer\/wp-json\/wp\/v2\/media?parent=4207"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}