Skip to content

Commit

Permalink
comment out wrong lines
Browse files Browse the repository at this point in the history
  • Loading branch information
EnricoSchw committed Jan 15, 2024
1 parent d7a40a3 commit 6743a09
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 5 deletions.
9 changes: 9 additions & 0 deletions projects/core/src/lib/component/guest/guest.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<div class="participant-action">
<button class="btn-mic-off"></button>
<button class="btn-camera-off"></button>
<md-switch id="switch-{{ guest?.stream?.id }}" icons class="active-video"
(click)="toggleActive()"></md-switch>
</div>
<a href="#" class="name-tag">{{ guest?.user?.name }}</a>
<video id="video-{{ guest?.stream?.id }}" #videoElement muted autoplay></video>

64 changes: 64 additions & 0 deletions projects/core/src/lib/component/guest/guest.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
import {
AfterViewInit,
Component, ElementRef,
HostBinding,
Input,
OnDestroy, ViewChild,
ViewEncapsulation
} from '@angular/core';
import {Guest} from '../../entities';

@Component({
selector: 'shig-guest',
templateUrl: './guest.component.html',
styleUrls: [
'./../../../../assets/scss/lobby.scss',
'./../../../../assets/scss/styles.scss'
],
encapsulation: ViewEncapsulation.None
})
export class GuestComponent implements AfterViewInit, OnDestroy {

@HostBinding('class.guest-video') public hostClass = true;
@ViewChild('videoElement') videoRef!: ElementRef<HTMLVideoElement>;

@Input() activateGuestStreamCbk!: (g: Guest) => void;
@Input() deactivateGuestStreamCbk!: (g: Guest) => void;
@Input('guest') guest!: Guest;

ngAfterViewInit() {
this.getVideoElement().srcObject = this.guest?.stream;
}

public updateGuest(guest: Guest): void {
const oldGuest = this.guest;
this.guest = guest;
this.getVideoElement().srcObject = this.guest?.stream;
if (oldGuest.stream.id !== this.guest.stream.id) {
// if get a complete new stream, stop the old stream
// this happens often for local users
oldGuest.stopStream();
}
}

ngOnDestroy(): void {
this.getVideoElement().srcObject = null;
this.guest.stopStream();
}

toggleActive() {
const shadowRoot = document.getElementById(`switch-${this.guest.stream.id}`)?.shadowRoot;
const isSelected = !shadowRoot?.querySelector('div')?.classList.contains('selected');

if (isSelected) {
this.activateGuestStreamCbk(this.guest);
} else {
this.deactivateGuestStreamCbk(this.guest);
}
}

private getVideoElement(): HTMLVideoElement {
return this.videoRef.nativeElement;
}
}

2 changes: 1 addition & 1 deletion projects/core/src/lib/provider/webrtc-connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ export class WebrtcConnection extends EventEmitter<MediaEvent> {
}

private onRemoteOffer() {
SDPParser.parse(this.peerConnection.remoteDescription);
// SDPParser.parse(this.peerConnection.remoteDescription);
}

}
8 changes: 4 additions & 4 deletions projects/core/src/lib/provider/webrtc-sdp-munge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ export function getInactiveTransceiver(sdp: RTCSessionDescription): SdpMediaLine
const inactive: SdpMediaLine[] = [];
res.media.forEach((m) => {

if (m.mid !== undefined) {
m.type
inactive.push(m.mid);
}
// if (m.mid !== undefined) {
// m.type
// inactive.push(m.mid);
// }
});
return inactive;
}

0 comments on commit 6743a09

Please sign in to comment.