|
3 | 3 | using System.Linq; |
4 | 4 | using System.Threading.Tasks; |
5 | 5 | using NUnit.Framework; |
| 6 | +using StreamVideo.Core; |
6 | 7 | using StreamVideo.Core.StatefulModels.Tracks; |
7 | 8 | using StreamVideo.Tests.Shared; |
8 | 9 | using UnityEngine; |
@@ -35,27 +36,32 @@ public IEnumerator When_client_joins_call_with_video_expect_receiving_video_trac |
35 | 36 | private async Task When_client_joins_call_with_video_expect_receiving_video_track_Async( |
36 | 37 | ITestClient clientA, ITestClient clientB) |
37 | 38 | { |
38 | | - var streamCall = await clientA.JoinRandomCallAsync(); |
| 39 | + var clientACall = await clientA.JoinRandomCallAsync(); |
39 | 40 |
|
40 | 41 | var cameraDevice = await TestUtils.TryGetFirstWorkingCameraDeviceAsync(clientA.Client); |
41 | 42 | Debug.Log("Selected camera device: " + cameraDevice); |
42 | 43 | clientA.Client.VideoDeviceManager.SelectDevice(cameraDevice, enable: true); |
43 | 44 |
|
44 | | - var call = await clientB.Client.JoinCallAsync(streamCall.Type, streamCall.Id, create: false, |
| 45 | + var clientBCall = await clientB.Client.JoinCallAsync(clientACall.Type, clientACall.Id, create: false, |
45 | 46 | ring: false, |
46 | 47 | notify: false); |
47 | 48 |
|
48 | | - var otherParticipant = call.Participants.First(p => !p.IsLocalParticipant); |
| 49 | + // Wait for client B to get client A participant |
| 50 | + await WaitForConditionAsync(() |
| 51 | + => clientBCall.Participants.Any(p => p.SessionId == clientACall.GetLocalParticipant().SessionId)); |
| 52 | + |
| 53 | + var clientAParticipant = clientBCall.Participants.First(p => p.SessionId == clientACall.GetLocalParticipant().SessionId); |
| 54 | + clientAParticipant.UpdateRequestedVideoResolution(VideoResolution.Res_720p); |
49 | 55 |
|
50 | 56 | StreamVideoTrack streamTrack = null; |
51 | 57 |
|
52 | | - if (otherParticipant.VideoTrack != null) |
| 58 | + if (clientAParticipant.VideoTrack != null) |
53 | 59 | { |
54 | | - streamTrack = (StreamVideoTrack)otherParticipant.VideoTrack; |
| 60 | + streamTrack = (StreamVideoTrack)clientAParticipant.VideoTrack; |
55 | 61 | } |
56 | 62 | else |
57 | 63 | { |
58 | | - otherParticipant.TrackAdded += (_, track) => { streamTrack = (StreamVideoTrack)track; }; |
| 64 | + clientAParticipant.TrackAdded += (_, track) => { streamTrack = (StreamVideoTrack)track; }; |
59 | 65 |
|
60 | 66 | await WaitForConditionAsync(() => streamTrack != null); |
61 | 67 | } |
|
0 commit comments