{"id":4335,"date":"2021-11-17T17:23:57","date_gmt":"2021-11-17T09:23:57","guid":{"rendered":"https:\/\/www.enablex.io\/developer\/?page_id=4335"},"modified":"2025-04-04T22:04:27","modified_gmt":"2025-04-04T14:04:27","slug":"switch-camera-mic-speaker","status":"publish","type":"page","link":"https:\/\/doc.smartflomeet.ttns.in\/developer\/video-api\/client-api\/ios-toolkit\/switch-camera-mic-speaker\/","title":{"rendered":"Switch Camera, Microphone &#038; Speaker: iOS 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<div style=\"height:20px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\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>- (NSException*) switchCamera;<\/code> <\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">[localstream switchCamera];<\/pre>\n\n\n\n<p><strong>Error Code \/ 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 name 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>\u2013 (void)switchMediaDevice:(NSString *)mediaName<\/code><\/p>\n\n\n\n<p><strong>Parameters: <\/strong> <code>mediaName<\/code> &#8211; String. Target Microphone Device Name.<\/p>\n\n\n\n<p><strong>Delegate Method: <\/strong>  <code>- didNotifyDeviceUpdate:<\/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:@\u201dmediaName\u201d];\n\n-(void)didNotifyDeviceUpdate:(NSString *)updates{\n\t\/\/ updates carry new device 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>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: &#8211; (NSException*) switchCamera; [localstream switchCamera]; Error Code&hellip; <\/p>\n","protected":false},"author":1,"featured_media":0,"parent":3732,"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\/4335"}],"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=4335"}],"version-history":[{"count":0,"href":"https:\/\/doc.smartflomeet.ttns.in\/developer\/wp-json\/wp\/v2\/pages\/4335\/revisions"}],"up":[{"embeddable":true,"href":"https:\/\/doc.smartflomeet.ttns.in\/developer\/wp-json\/wp\/v2\/pages\/3732"}],"wp:attachment":[{"href":"https:\/\/doc.smartflomeet.ttns.in\/developer\/wp-json\/wp\/v2\/media?parent=4335"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}