Skip to content

Commit 402f970

Browse files
committed
Start play after publish started
1 parent d282a7e commit 402f970

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

WebRTC-Sample-App/ConferenceViewController.swift

+11-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,14 @@ open class ConferenceViewController: UIViewController , AVCaptureVideoDataOutput
7979
self.conferenceClient?.publish(streamId: self.publisherStreamId, token: "", mainTrackId: roomId);
8080

8181
//this plays the streams in the room
82-
self.conferenceClient?.play(streamId: self.roomId);
82+
83+
//self.conferenceClient?.play(streamId: self.roomId);
84+
85+
//In order to make the play consistent, we've moved this method to the publish_started callback below
86+
//because if this is the first user and second user join the call immediately after this user,
87+
//it takes up to 8 seconds to play the stream. Because it thinks there is no user in the room,
88+
//it will try to play again after timeout(5 secs) and it may take about 2-3 seconds to start play
89+
8390
}
8491

8592
open override func viewWillDisappear(_ animated: Bool) {
@@ -217,6 +224,9 @@ extension ConferenceViewController: AntMediaClientDelegate
217224

218225
public func publishStarted(streamId: String) {
219226
AntMediaClient.printf("Publish started for stream:\(streamId)")
227+
228+
//this plays the streams in the room
229+
self.conferenceClient?.play(streamId: self.roomId);
220230
}
221231

222232
public func publishFinished(streamId: String) {

0 commit comments

Comments
 (0)