Skip to content

Commit ce5ecd5

Browse files
authored
Merge pull request #284 from nathanGroovy/dev/WebGL-46-New
Dev/web gl 46 new
2 parents 7ca4f9a + e18034d commit ce5ecd5

File tree

33 files changed

+3550
-839
lines changed

33 files changed

+3550
-839
lines changed

Assets/API-Example/datastream-sample/DataStream.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -203,10 +203,8 @@ public VideoSurface makeImageSurface(string goName)
203203
}
204204
// set up transform
205205
go.transform.Rotate(0f, 0.0f, 180.0f);
206-
float xPos = Random.Range(Offset - Screen.width / 2f, Screen.width / 2f - Offset);
207-
float yPos = Random.Range(Offset, Screen.height / 2f - Offset);
208-
Debug.Log("position x " + xPos + " y: " + yPos);
209-
go.transform.localPosition = new Vector3(xPos, yPos, 0f);
206+
Vector2 pos = AgoraUIUtils.GetRandomPosition(60);
207+
go.transform.localPosition = new Vector3(pos.x, pos.y, 0f);
210208
go.transform.localScale = new Vector3(1.5f, 1f, 1f);
211209

212210
// configure videoSurface

Assets/API-Example/device-manager/AgoraDeviceManager.cs

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Assets/API-Example/geo-area-sample/HelloVideoAgora2.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -183,10 +183,8 @@ public VideoSurface makeImageSurface(string goName)
183183
}
184184
// set up transform
185185
go.transform.Rotate(0f, 0.0f, 180.0f);
186-
float xPos = Random.Range(Offset - Screen.width / 2f, Screen.width / 2f - Offset);
187-
float yPos = Random.Range(Offset, Screen.height / 2f - Offset);
188-
Debug.Log("position x " + xPos + " y: " + yPos);
189-
go.transform.localPosition = new Vector3(xPos, yPos, 0f);
186+
Vector2 pos = AgoraUIUtils.GetRandomPosition(60);
187+
go.transform.localPosition = new Vector3(pos.x, pos.y, 0f);
190188
go.transform.localScale = new Vector3(3f, 4f, 1f);
191189

192190
// configure videoSurface

Assets/API-Example/push-video-frame/AgoraScreenShare.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -364,10 +364,8 @@ public VideoSurface makeImageSurface(string goName)
364364
}
365365
// set up transform
366366
go.transform.Rotate(0f, 0.0f, 180.0f);
367-
float xPos = Random.Range(Offset - Screen.width / 2f, Screen.width / 2f - Offset);
368-
float yPos = Random.Range(Offset, Screen.height / 2f - Offset);
369-
Debug.Log("position x " + xPos + " y: " + yPos);
370-
go.transform.localPosition = new Vector3(xPos, yPos, 0f);
367+
Vector2 pos = AgoraUIUtils.GetRandomPosition(60);
368+
go.transform.localPosition = new Vector3(pos.x, pos.y, 0f);
371369
//go.transform.localPosition = new Vector3(10, 10, 0f);
372370
go.transform.localScale = new Vector3(1 * 1.33333f, 1f, 1f);
373371

Assets/API-Example/rtmp-streaming/RtmpStreaming.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -298,10 +298,8 @@ public VideoSurface makeImageSurface(string goName)
298298

299299
// set up transform
300300
go.transform.Rotate(0f, 0.0f, 180.0f);
301-
float xPos = Random.Range(Offset - Screen.width / 2f, Screen.width / 2f - Offset);
302-
float yPos = Random.Range(Offset, Screen.height / 2f - Offset);
303-
Debug.Log("position x " + xPos + " y: " + yPos);
304-
go.transform.localPosition = new Vector3(xPos, yPos, 0f);
301+
Vector2 pos = AgoraUIUtils.GetRandomPosition(60);
302+
go.transform.localPosition = new Vector3(pos.x, pos.y, 0f);
305303
go.transform.localScale = new Vector3(3f, 4f, 1f);
306304

307305
// configure videoSurface

Assets/API-Example/screen-sharing/AgoraScreenSharingClientManager.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -385,9 +385,8 @@ public VideoSurface makeImageSurface(string goName)
385385

386386
// set up transform
387387
go.transform.Rotate(0f, 0.0f, 180.0f);
388-
float xPos = Random.Range(Offset - Screen.width / 4f, Screen.width / 4f - Offset);
389-
float yPos = Random.Range(Offset, Screen.height / 4f - Offset);
390-
go.transform.localPosition = new Vector3(xPos, yPos, 0f);
388+
Vector2 pos = AgoraUIUtils.GetRandomPosition(60);
389+
go.transform.localPosition = new Vector3(pos.x, pos.y, 0f);
391390
go.transform.localScale = new Vector3(1.5f, 1f, 1f);
392391

393392
// configure videoSurface

0 commit comments

Comments
 (0)