{"id":4319,"date":"2021-11-16T20:44:41","date_gmt":"2021-11-16T12:44:41","guid":{"rendered":"https:\/\/www.enablex.io\/developer\/?page_id=4319"},"modified":"2025-04-05T02:28:06","modified_gmt":"2025-04-04T18:28:06","slug":"participant-role-switch","status":"publish","type":"page","link":"https:\/\/doc.smartflomeet.ttns.in\/developer\/video-api\/client-api\/android-toolkit\/participant-role-switch\/","title":{"rendered":"Participant Role Switch: Android SDK &#8211; Video API"},"content":{"rendered":"\n<p>The <code>EnxRoom.switchUserRole()<\/code> method allows the Moderator to promote a Participant to act as a Moderator in the ongoing Session. This newly appointed Moderator gets access to Moderator Controls and the former Moderator becomes a Participant in the Session. The new Moderator can further grant the Moderator role to another participant if so desired. <\/p>\n\n\n\n<p><strong>Class<\/strong>: <code>EnxRoom<\/code><\/p>\n\n\n\n<p><strong>Method<\/strong>:  <code>public void switchUserRole(String ClientId) <\/code><\/p>\n\n\n\n<p><strong>Parameter<\/strong>: <code>ClientId <\/code>&#8211; Client ID of the participant who is being designated as Moderator<\/p>\n\n\n\n<p><strong>Callbacks:<\/strong><\/p>\n\n\n\n<ul><li><code>onSwitchedUserRoleChange<\/code> \u2013 Acknowledgment to the Moderator when a Switch User Role is requested. <\/li><li><code>onUserRoleChanged<\/code> &#8211; Notification to all participants in the Room when a participant is newly appointed as the Moderator. The appointed moderator is notified with extra information required to moderate the Session.  <\/li><\/ul>\n\n\n\n<pre class=\"wp-block-preformatted\">room.switchUserRole(clientId); \/\/ Role Change Request from Moderator\n\npublic void onSwitchedUserRole(JSONObject jsonObject){\n\t\/\/ Moderator is acknowledged\n}\n\npublic void onUserRoleChanged(JSONObject jsonObject){\n\t\/\/ All Participants are notified - jsonObject\n\t\/*\n\t{\t\"moderator\": false, \/\/ You are not a moderator\n\t\t\"clientId\": \"XXX\"   \/\/ New Moderator's Client ID\n\t}\n\t*\/\n    \n\t\/\/ New Moderator is notified  - jsonObject\n\t\/*\n\t{   \"moderator\": true,  \/\/ You are a moderator\n\t\t\"clientId\": \"XXX\",  \/\/ New Moderator's Client ID i.e. You\n\t\t\"raisedHands\":[],   \/\/ List of Client IDs requesting Floor Access\n\t\t\"approvedHands\":[]  \/\/ List of Client IDs with Floor Access\n\t}\n\t*\/\n}<\/pre>\n\n\n\n<p><strong>Error Codes &amp; 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>5085<\/td><td>Unauthorized Access. When a user with <code>participant<\/code> role invokes <code>switchUserRole()<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\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=\"\/developer\/video-api\/client-api\/android-toolkit\/destroy-session\/\"><\/a><a href=\"\/developer\/video-api\/client-api\/android-toolkit\/destroy-session\/\">Destroy Session<\/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=\"..\/pin-user\/\">Pin Users<\/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 EnxRoom.switchUserRole() method allows the Moderator to promote a Participant to act as a Moderator in the ongoing Session. This newly appointed Moderator gets access to Moderator Controls and the former Moderator becomes a Participant in the Session. The new Moderator can further grant the Moderator role to another participant if so desired. Class: EnxRoom Method: public void switchUserRole(String ClientId) Parameter: ClientId &#8211; Client ID of the participant who is&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 EnxRoom.switchUserRole() method allows the Moderator to promote a Participant to act as a Moderator in the ongoing Session. This newly appointed Moderator gets access to Moderator Controls and the former Moderator becomes a Participant in the Session. The new Moderator can further grant the Moderator role to another participant if so desired. Class: EnxRoom&hellip;","_links":{"self":[{"href":"https:\/\/doc.smartflomeet.ttns.in\/developer\/wp-json\/wp\/v2\/pages\/4319"}],"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=4319"}],"version-history":[{"count":0,"href":"https:\/\/doc.smartflomeet.ttns.in\/developer\/wp-json\/wp\/v2\/pages\/4319\/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=4319"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}