@@ -35,7 +35,7 @@ public class AgoraDeviceManager : MonoBehaviour
3535 private const float Offset = 100 ;
3636 GameObject LastRemote = null ;
3737 public Slider recordingVolume , playbackVolume ;
38- public bool joinedChannel , previewing ;
38+ public bool joinedChannel , previewing , pubAudio , subAudio , pubVideo , subVideo = true ;
3939 public Button videoDeviceButton , joinChannelButton , leaveChannelButton , startPreviewButton , stopPreviewButton , cacheVideoButton ;
4040 // Start is called before the first frame update
4141 private void Awake ( )
@@ -114,6 +114,7 @@ public void cacheVideoDevices()
114114 {
115115#if UNITY_WEBGL && ! UNITY_EDITOR
116116 _rtcEngine . CacheVideoDevices ( ) ;
117+ pubVideo = true ;
117118 Invoke ( "GetVideoDeviceManager" , .2f ) ;
118119#endif
119120 }
@@ -122,6 +123,7 @@ public void cacheRecordingDevices()
122123 {
123124#if UNITY_WEBGL && ! UNITY_EDITOR
124125 _rtcEngine . CacheRecordingDevices ( ) ;
126+ pubAudio = true ;
125127 Invoke ( "GetAudioRecordingDevice" , .2f ) ;
126128#endif
127129 }
@@ -132,6 +134,7 @@ public void cachePlaybackDevices()
132134 {
133135#if UNITY_WEBGL && ! UNITY_EDITOR
134136 _rtcEngine . CachePlaybackDevices ( ) ;
137+ subAudio = true ;
135138 Invoke ( "GetAudioPlaybackDevice" , .2f ) ;
136139#endif
137140 }
@@ -145,21 +148,31 @@ bool CheckAppId()
145148 public void playbackUpdate ( )
146149 {
147150 _playbackDeviceIndex = playbackDropdown . value ;
151+ subAudio = true ;
148152 SetAndReleasePlaybackDevice ( ) ;
149153 }
150154
151155 public void recordingUpdate ( )
152156 {
153157 _recordingDeviceIndex = recordingDropdown . value ;
158+ pubAudio = true ;
154159 SetAndReleaseRecordingDevice ( ) ;
155160 }
156161
157162 public void videoUpdate ( )
158163 {
159164 _videoDeviceIndex = videoDropdown . value ;
165+ pubVideo = true ;
160166 SetVideoDevice ( ) ;
161167 }
162168
169+ public void updateAll ( )
170+ {
171+ videoUpdate ( ) ;
172+ recordingUpdate ( ) ;
173+ playbackUpdate ( ) ;
174+ }
175+
163176 public void startPreview ( )
164177 {
165178 previewing = true ;
@@ -345,7 +358,7 @@ public void JoinChannel()
345358
346359 public void startJoiningChannel ( )
347360 {
348- _rtcEngine . JoinChannel ( CHANNEL_NAME ) ;
361+ _rtcEngine . JoinChannel ( appInfo . token , CHANNEL_NAME , "" , 0 , new ChannelMediaOptions ( subAudio , subVideo , pubAudio , pubVideo ) ) ;
349362 makeVideoView ( CHANNEL_NAME , 0 ) ;
350363 }
351364
0 commit comments