|
10 | 10 | import android.view.ViewGroup; |
11 | 11 | import android.widget.Button; |
12 | 12 | import android.widget.EditText; |
| 13 | +import android.widget.SeekBar; |
13 | 14 |
|
14 | 15 | import androidx.annotation.NonNull; |
15 | 16 | import androidx.annotation.Nullable; |
|
36 | 37 | actionId = R.id.action_mainFragment_to_PlayAudioFiles, |
37 | 38 | tipsId = R.string.playaudiofiles |
38 | 39 | ) |
39 | | -public class PlayAudioFiles extends BaseFragment implements View.OnClickListener { |
| 40 | +public class PlayAudioFiles extends BaseFragment implements View.OnClickListener, SeekBar.OnSeekBarChangeListener { |
40 | 41 | private static final String TAG = PlayAudioFiles.class.getSimpleName(); |
41 | 42 | private EditText et_channel; |
42 | 43 | private Button mute, join, speaker, bgm, effect; |
| 44 | + private SeekBar mixingPublishVolBar, mixingPlayoutVolBar, mixingVolBar; |
43 | 45 | private RtcEngine engine; |
44 | 46 | private int myUid; |
45 | 47 | private boolean joined = false; |
@@ -75,6 +77,12 @@ public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceStat |
75 | 77 | bgm.setOnClickListener(this); |
76 | 78 | effect = view.findViewById(R.id.btn_effect); |
77 | 79 | effect.setOnClickListener(this); |
| 80 | + mixingPublishVolBar = view.findViewById(R.id.mixingPublishVolBar); |
| 81 | + mixingPlayoutVolBar = view.findViewById(R.id.mixingPlayoutVolBar); |
| 82 | + mixingVolBar = view.findViewById(R.id.mixingVolBar); |
| 83 | + mixingPlayoutVolBar.setOnSeekBarChangeListener(this); |
| 84 | + mixingPublishVolBar.setOnSeekBarChangeListener(this); |
| 85 | + mixingVolBar.setOnSeekBarChangeListener(this); |
78 | 86 | } |
79 | 87 |
|
80 | 88 | @Override |
@@ -417,4 +425,40 @@ public void onUserOffline(int uid, int reason) |
417 | 425 | showLongToast(String.format("user %d offline! reason:%d", uid, reason)); |
418 | 426 | } |
419 | 427 | }; |
| 428 | + |
| 429 | + @Override |
| 430 | + public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { |
| 431 | + if(seekBar.getId() == R.id.mixingPublishVolBar){ |
| 432 | + /** |
| 433 | + * Adjusts the volume of audio mixing for publishing (sending to other users). |
| 434 | + * @param volume: Audio mixing volume for publishing. The value ranges between 0 and 100 (default). |
| 435 | + */ |
| 436 | + engine.adjustAudioMixingPublishVolume(progress); |
| 437 | + } |
| 438 | + else if(seekBar.getId() == R.id.mixingPlayoutVolBar){ |
| 439 | + /** |
| 440 | + * Adjusts the volume of audio mixing for local playback. |
| 441 | + * @param volume: Audio mixing volume for local playback. The value ranges between 0 and 100 (default). |
| 442 | + */ |
| 443 | + engine.adjustAudioMixingPlayoutVolume(progress); |
| 444 | + } |
| 445 | + else if(seekBar.getId() == R.id.mixingVolBar){ |
| 446 | + /** |
| 447 | + * Adjusts the volume of audio mixing. |
| 448 | + * Call this method when you are in a channel. |
| 449 | + * @param volume: Audio mixing volume. The value ranges between 0 and 100 (default). |
| 450 | + */ |
| 451 | + engine.adjustAudioMixingVolume(progress); |
| 452 | + } |
| 453 | + } |
| 454 | + |
| 455 | + @Override |
| 456 | + public void onStartTrackingTouch(SeekBar seekBar) { |
| 457 | + |
| 458 | + } |
| 459 | + |
| 460 | + @Override |
| 461 | + public void onStopTrackingTouch(SeekBar seekBar) { |
| 462 | + |
| 463 | + } |
420 | 464 | } |
0 commit comments