@@ -68,7 +68,6 @@ export default class DialogAdapter {
68
68
this . _recvTaskId = null ;
69
69
this . _closed = true ;
70
70
this . scene = document . querySelector ( "a-scene" ) ;
71
- this . _webcams = { } ; // { [consumerId]: {stream,order}, ["mine"]: {} }
72
71
}
73
72
74
73
get serverUrl ( ) {
@@ -406,25 +405,13 @@ export default class DialogAdapter {
406
405
consumer . on ( "transportclose" , ( ) => {
407
406
this . emitRTCEvent ( "error" , "RTC" , ( ) => `Consumer transport closed` ) ;
408
407
this . removeConsumer ( consumer . id ) ;
409
- this . removeWebcam ( consumer . id ) ;
410
-
411
- console . log ( "NAF dialog adapter.js request(): transportclosed" ) ;
412
- // console.log("producerId: " + producerId);
413
- // console.log("consumer.id: " + consumer.id);
414
- // console.log("peerId: " + peerId);
415
408
} ) ;
416
409
417
410
// We are ready. Answer the protoo request so the server will
418
411
// resume this Consumer (which was paused for now if video).
419
412
accept ( ) ;
420
413
421
- // this.resolvePendingMediaRequestForTrack(peerId, consumer.track);
422
-
423
- this . resolvePendingMediaRequestForTrack ( peerId , consumer . track , consumer . id ) ;
424
-
425
- if ( kind === "video" ) {
426
- console . log ( "Is video stream" ) ;
427
- }
414
+ this . resolvePendingMediaRequestForTrack ( peerId , consumer . track ) ;
428
415
429
416
if ( kind === "audio" ) {
430
417
const initialAudioResolver = this . _initialAudioConsumerResolvers . get ( peerId ) ;
@@ -509,7 +496,6 @@ export default class DialogAdapter {
509
496
510
497
consumer . close ( ) ;
511
498
this . removeConsumer ( consumer . id ) ;
512
- this . removeWebcam ( consumer . id ) ;
513
499
514
500
break ;
515
501
}
@@ -533,69 +519,20 @@ export default class DialogAdapter {
533
519
await Promise . all ( [ this . updateTimeOffset ( ) , this . _initialAudioConsumerPromise ] ) ;
534
520
}
535
521
536
- removeWebcam ( consumerId ) {
537
- console . log ( "removeWebCam()" ) ;
538
- console . log ( "removeWebCam() consumerId: " + consumerId ) ;
539
- // const video = document.getElementById("webcam-feed-" + consumerId);
540
- // console.log(video);
541
- const webcam = this . _webcams [ consumerId ] ;
542
- if ( webcam ) {
543
- delete this . _webcams [ consumerId ] ;
544
- } else {
545
- // doesn't exist
546
- console . error ( "The consumerId doesnt exist to delete webcam" ) ;
547
- }
548
- this . scene . emit ( "webcams-changed" ) ;
549
- // if (video) {
550
- // console.log("video exists");
551
- // console.log(video);
552
- // video.remove();
553
- // }
554
- }
555
-
556
- removeMyWebcam ( ) {
557
- console . log ( "removeMyWebCam()" ) ;
558
- this . removeWebcam ( "mine" ) ;
559
- }
560
-
561
- addWebcam ( consumerId , stream ) {
562
- // consumerId | mine
563
- // consumerId or mine
564
- console . log ( "addWebcam()" ) ;
565
- console . log ( "clientId: " + consumerId ) ;
566
- const webcam = this . _webcams [ consumerId ] ;
567
- if ( ! webcam ) {
568
- this . _webcams [ consumerId ] = { consumerId, stream, order : - 1 } ;
569
- } else {
570
- // exists
571
- this . _webcams [ consumerId ] . stream = stream ;
572
- }
573
- this . scene . emit ( "webcams-changed" ) ;
574
- }
575
-
576
522
shouldStartConnectionTo ( ) {
577
523
return true ;
578
524
}
579
525
startStreamConnection ( ) { }
580
526
581
527
closeStreamConnection ( ) { }
582
528
583
- resolvePendingMediaRequestForTrack ( clientId , track , consumerId ) {
529
+ resolvePendingMediaRequestForTrack ( clientId , track ) {
584
530
const requests = this . _pendingMediaRequests . get ( clientId ) ;
585
531
586
532
if ( requests && requests [ track . kind ] ) {
587
533
const resolve = requests [ track . kind ] . resolve ;
588
534
delete requests [ track . kind ] ;
589
- // resolve(new MediaStream([track]));
590
- const stream = new MediaStream ( [ track ] ) ;
591
-
592
- if ( track . kind === "video" ) {
593
- console . log ( 2 ) ;
594
- // this.addWebcam(clientId, stream);
595
- if ( consumerId === undefined ) this . addWebcam ( "mine" , stream ) ;
596
- else this . addWebcam ( consumerId , stream ) ;
597
- }
598
- resolve ( stream ) ;
535
+ resolve ( new MediaStream ( [ track ] ) ) ;
599
536
}
600
537
601
538
if ( requests && Object . keys ( requests ) . length === 0 ) {
0 commit comments