File tree 1 file changed +8
-4
lines changed
1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -188,7 +188,7 @@ WebRTCClient.prototype.setLocalDescription = function(desc) {
188
188
189
189
pc . setLocalDescription ( new RTCSessionDescription ( desc ) )
190
190
. catch ( err => {
191
- callback ( err ) ;
191
+ callback ( err ) ; cd
192
192
} ) ;
193
193
} , desc ) ;
194
194
} ;
@@ -198,11 +198,15 @@ WebRTCClient.prototype.setLocalDescription = function(desc) {
198
198
WebRTCClient . prototype . setRemoteDescription = function ( desc ) {
199
199
return this . driver . executeAsyncScript ( function ( desc ) {
200
200
var callback = arguments [ arguments . length - 1 ] ;
201
-
202
- pc . onaddstream = function ( event ) {
201
+ pc . ontrack = function ( event ) {
202
+ var id = event . streams [ 0 ] . id ;
203
+ if ( document . getElementById ( 'video-' + id ) ) {
204
+ return ;
205
+ }
203
206
var video = document . createElement ( 'video' ) ;
207
+ video . id = 'video-' + id ;
204
208
video . autoplay = true ;
205
- video . srcObject = event . stream ;
209
+ video . srcObject = event . streams [ 0 ] ;
206
210
document . body . appendChild ( video ) ;
207
211
} ;
208
212
pc . setRemoteDescription ( new RTCSessionDescription ( desc ) )
You can’t perform that action at this time.
0 commit comments