openvidu-components: minor adjustments

This commit is contained in:
pabloFuente 2022-08-05 14:20:27 +02:00
parent 56c6a3044e
commit 09aedf8109
8 changed files with 14 additions and 20 deletions

View File

@ -69,6 +69,7 @@ export class AppComponent {
screen: await this.getToken(),
};
}
subscribeToPanelToggling() {
this.panelService.panelOpenedObs.subscribe(
(ev: { opened: boolean; type?: PanelType | string }) => {

View File

@ -54,10 +54,11 @@ export class AppComponent implements OnInit {
};
}
async ngOnDestroy() {
ngOnDestroy() {
this.localParticipantSubs.unsubscribe();
this.remoteParticipantsSubs.unsubscribe();
}
subscribeToParticipants() {
this.localParticipantSubs = this.participantService.localParticipantObs.subscribe((p) => {
this.localParticipant = p;

View File

@ -30,10 +30,7 @@ export class AppComponent implements OnInit {
connected = true;
constructor(
private httpClient: HttpClient,
private openviduService: OpenViduService
) { }
constructor(private httpClient: HttpClient, private openviduService: OpenViduService) { }
async ngOnInit() {
this.tokens = {

View File

@ -44,10 +44,7 @@ export class AppComponent implements OnInit {
localParticipantSubs!: Subscription;
remoteParticipantsSubs!: Subscription;
constructor(
private httpClient: HttpClient,
private participantService: ParticipantService
) { }
constructor(private httpClient: HttpClient, private participantService: ParticipantService) { }
async ngOnInit() {
this.tokens = {
@ -65,7 +62,6 @@ export class AppComponent implements OnInit {
this.localParticipantSubs = this.participantService.localParticipantObs.subscribe((p) => {
this.localParticipant = p;
});
this.remoteParticipantsSubs = this.participantService.remoteParticipantsObs.subscribe((participants) => {
this.remoteParticipants = participants;
});

View File

@ -1,4 +1,5 @@
<ov-videoconference (onSessionCreated)="onSessionCreated($event)" [tokens]="tokens" [prejoin]="true">
<div *ovToolbarAdditionalButtons>
<button toolbar-btn mat-icon-button (click)="handleLocalHand()" [class.active-btn]="hasHandRaised">
<mat-icon matTooltip="Toggle hand">front_hand</mat-icon>
@ -7,7 +8,6 @@
<div *ovStream="let stream" style="height: 100%">
<ov-stream [stream]="stream"></ov-stream>
<button mat-icon-button @inOutHandAnimation id="hand-notification" *ngIf="stream.participant.hasHandRaised">
<mat-icon>front_hand</mat-icon>
</button>
@ -18,4 +18,5 @@
<mat-icon>front_hand</mat-icon>
</button>
</div>
</ov-videoconference>
</ov-videoconference>

View File

@ -52,7 +52,7 @@ export class AppComponent implements OnInit {
}
handleRemoteHand() {
// Subscribe to hand toggling events from others
// Subscribe to hand toggling events from other participants
this.session.on(`signal:${SignalApp.HAND_TOGGLE}`, (event: any) => {
const connectionId = event.from.connectionId;
const participant = <ParticipantAppModel>this.participantService.getRemoteParticipantByConnectionId(connectionId);

View File

@ -1,13 +1,11 @@
import { StreamModel, ParticipantAbstractModel } from 'openvidu-angular';
import { ParticipantAbstractModel } from 'openvidu-angular';
export class ParticipantAppModel extends ParticipantAbstractModel {
hasHandRaised: boolean;
// constructor(model?:StreamModel, id?: string) {
// super(model, id);
// }
toggleHandRaised() {
this.hasHandRaised = !this.hasHandRaised;
}
}
}

View File

@ -7,7 +7,7 @@ import { TokenModel, OpenViduService, ParticipantService } from "openvidu-angula
@Component({
selector: 'app-root',
template: `
<ov-videoconference [tokens]="tokens" [toolbarDisplaySessionName]="false">
<ov-videoconference [tokens]="tokens" [toolbarDisplaySessionName]="false">
<div *ovToolbarAdditionalButtons style="text-align: center;">
<button mat-icon-button (click)="toggleVideo()">
<mat-icon>videocam</mat-icon>