4040)
4141public class SetAudioProfile extends BaseFragment implements View .OnClickListener {
4242 private static final String TAG = JoinChannelAudio .class .getSimpleName ();
43+ private Spinner audioProfileInput ;
4344 private Spinner audioScenarioInput ;
4445 private EditText et_channel ;
4546 private Button mute , join , speaker ;
@@ -68,6 +69,7 @@ public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceStat
6869 super .onViewCreated (view , savedInstanceState );
6970 join = view .findViewById (R .id .btn_join );
7071 et_channel = view .findViewById (R .id .et_channel );
72+ audioProfileInput = view .findViewById (R .id .audio_profile_spinner );
7173 audioScenarioInput = view .findViewById (R .id .audio_scenario_spinner );
7274 view .findViewById (R .id .btn_join ).setOnClickListener (this );
7375 mute = view .findViewById (R .id .microphone );
@@ -110,7 +112,7 @@ public void onActivityCreated(@Nullable Bundle savedInstanceState)
110112 * The SDK uses this class to report to the app on SDK runtime events.
111113 */
112114 config .mEventHandler = iRtcEngineEventHandler ;
113- config .mAudioScenario = Constants .AudioScenario .getValue ( Constants . AudioScenario . HIGH_DEFINITION );
115+ config .mAudioScenario = Constants .AudioScenario .valueOf ( audioScenarioInput . getSelectedItem (). toString ()). ordinal ( );
114116 engine = RtcEngine .create (config );
115117 }
116118 catch (Exception e )
@@ -147,6 +149,7 @@ public void onClick(View v)
147149 if (AndPermission .hasPermissions (this , Permission .Group .STORAGE , Permission .Group .MICROPHONE , Permission .Group .CAMERA ))
148150 {
149151 joinChannel (channelId );
152+ audioProfileInput .setEnabled (false );
150153 audioScenarioInput .setEnabled (false );
151154 return ;
152155 }
@@ -158,6 +161,7 @@ public void onClick(View v)
158161 {
159162 // Permissions Granted
160163 joinChannel (channelId );
164+ audioProfileInput .setEnabled (false );
161165 audioScenarioInput .setEnabled (false );
162166 }).start ();
163167 }
@@ -187,6 +191,7 @@ public void onClick(View v)
187191 speaker .setEnabled (false );
188192 mute .setText (getString (R .string .closemicrophone ));
189193 mute .setEnabled (false );
194+ audioProfileInput .setEnabled (true );
190195 audioScenarioInput .setEnabled (true );
191196 }
192197 }
@@ -223,8 +228,8 @@ private void joinChannel(String channelId)
223228 {
224229 accessToken = null ;
225230 }
226- int scenario = Constants .AudioScenario .valueOf (audioScenarioInput .getSelectedItem ().toString ()).ordinal ();
227- engine .setAudioProfile (scenario );
231+ int profile = Constants .AudioProfile .valueOf (audioProfileInput .getSelectedItem ().toString ()).ordinal ();
232+ engine .setAudioProfile (profile );
228233 /** Allows a user to join a channel.
229234 if you do not specify the uid, we will generate the uid for you*/
230235
0 commit comments