2022-03-11 12:11:41 +01:00
|
|
|
import { Component, ElementRef, Input, OnInit, Output, EventEmitter } from '@angular/core';
|
|
|
|
import { ILogger, LoggerService, OpenViduService } from 'openvidu-angular';
|
|
|
|
import { Session } from 'openvidu-browser';
|
2022-03-16 16:34:55 +01:00
|
|
|
import { ParticipantAbstractModel } from '../../../projects/openvidu-angular/src/lib/models/participant.model';
|
2022-01-24 11:18:23 +01:00
|
|
|
|
2022-03-16 14:19:04 +01:00
|
|
|
export interface TokenModel {
|
|
|
|
webcam: string;
|
|
|
|
screen: string;
|
2022-01-24 11:18:23 +01:00
|
|
|
}
|
|
|
|
|
2022-03-23 13:48:17 +01:00
|
|
|
/**
|
|
|
|
*
|
2022-03-25 12:39:24 +01:00
|
|
|
* **OpenviduWebComponentComponent** is a wrapper of the {@link VideoconferenceComponent} which allows to generate and export the OpenVidu Webcomponent.
|
|
|
|
* **It is not included in the library**.
|
2022-03-23 13:48:17 +01:00
|
|
|
*/
|
2022-01-24 11:18:23 +01:00
|
|
|
@Component({
|
2022-03-23 13:48:17 +01:00
|
|
|
templateUrl: './openvidu-webcomponent.component.html'
|
2022-01-24 11:18:23 +01:00
|
|
|
})
|
|
|
|
export class OpenviduWebComponentComponent implements OnInit {
|
2022-03-23 13:48:17 +01:00
|
|
|
/**
|
|
|
|
* @internal
|
|
|
|
*/
|
2022-03-16 14:19:04 +01:00
|
|
|
_tokens: TokenModel;
|
2022-03-23 13:48:17 +01:00
|
|
|
/**
|
|
|
|
* @internal
|
|
|
|
*/
|
2022-03-11 12:11:41 +01:00
|
|
|
_minimal: boolean = false;
|
2022-03-23 13:48:17 +01:00
|
|
|
/**
|
|
|
|
* @internal
|
|
|
|
*/
|
2022-03-16 14:19:04 +01:00
|
|
|
_participantName: string;
|
2022-03-23 13:48:17 +01:00
|
|
|
/**
|
|
|
|
* @internal
|
|
|
|
*/
|
2022-03-11 12:11:41 +01:00
|
|
|
_prejoin: boolean = true;
|
2022-03-23 13:48:17 +01:00
|
|
|
/**
|
|
|
|
* @internal
|
|
|
|
*/
|
2022-03-11 12:11:41 +01:00
|
|
|
_videoMuted: boolean = false;
|
2022-03-23 13:48:17 +01:00
|
|
|
/**
|
|
|
|
* @internal
|
|
|
|
*/
|
2022-03-11 12:11:41 +01:00
|
|
|
_audioMuted: boolean = false;
|
2022-03-23 13:48:17 +01:00
|
|
|
/**
|
|
|
|
* @internal
|
|
|
|
*/
|
2022-03-11 12:11:41 +01:00
|
|
|
_toolbarScreenshareButton: boolean = true;
|
2022-03-23 13:48:17 +01:00
|
|
|
/**
|
|
|
|
* @internal
|
|
|
|
*/
|
2022-03-11 12:11:41 +01:00
|
|
|
_toolbarFullscreenButton: boolean = true;
|
2022-03-23 13:48:17 +01:00
|
|
|
/**
|
|
|
|
* @internal
|
|
|
|
*/
|
2022-03-11 12:11:41 +01:00
|
|
|
_toolbarLeaveButton: boolean = true;
|
2022-03-23 13:48:17 +01:00
|
|
|
/**
|
|
|
|
* @internal
|
|
|
|
*/
|
2022-03-11 12:11:41 +01:00
|
|
|
_toolbarChatPanelButton: boolean = true;
|
2022-03-23 13:48:17 +01:00
|
|
|
/**
|
|
|
|
* @internal
|
|
|
|
*/
|
2022-03-11 12:11:41 +01:00
|
|
|
_toolbarParticipantsPanelButton: boolean = true;
|
2022-03-23 13:48:17 +01:00
|
|
|
/**
|
|
|
|
* @internal
|
|
|
|
*/
|
2022-03-11 12:11:41 +01:00
|
|
|
_toolbarDisplayLogo: boolean = true;
|
2022-03-23 13:48:17 +01:00
|
|
|
/**
|
|
|
|
* @internal
|
|
|
|
*/
|
2022-03-11 12:11:41 +01:00
|
|
|
_toolbarDisplaySessionName: boolean = true;
|
2022-03-23 13:48:17 +01:00
|
|
|
/**
|
|
|
|
* @internal
|
|
|
|
*/
|
2022-03-11 12:11:41 +01:00
|
|
|
_streamDisplayParticipantName: boolean = true;
|
2022-03-23 13:48:17 +01:00
|
|
|
/**
|
|
|
|
* @internal
|
|
|
|
*/
|
2022-03-11 12:11:41 +01:00
|
|
|
_streamDisplayAudioDetection: boolean = true;
|
2022-03-23 13:48:17 +01:00
|
|
|
/**
|
|
|
|
* @internal
|
|
|
|
*/
|
2022-03-11 12:11:41 +01:00
|
|
|
_streamSettingsButton: boolean = true;
|
2022-03-23 13:48:17 +01:00
|
|
|
/**
|
|
|
|
* @internal
|
|
|
|
*/
|
2022-03-11 12:11:41 +01:00
|
|
|
_participantPanelItemMuteButton: boolean = true;
|
|
|
|
|
2022-03-25 12:39:24 +01:00
|
|
|
/**
|
|
|
|
* The **minimal** attribute applies a minimal UI hiding all controls except for cam and mic.
|
|
|
|
*
|
|
|
|
* Default: `false`
|
|
|
|
*
|
|
|
|
* @example
|
|
|
|
* <openvidu-webcomponent minimal="true"></openvidu-webcomponent>
|
|
|
|
*/
|
2022-03-11 12:11:41 +01:00
|
|
|
@Input() set minimal(value: string | boolean) {
|
|
|
|
this._minimal = this.castToBoolean(value);
|
|
|
|
}
|
2022-03-25 12:39:24 +01:00
|
|
|
/**
|
|
|
|
* The **participantName** attribute sets the participant name. It can be useful for aplications which doesn't need the prejoin page.
|
|
|
|
*
|
|
|
|
* <div class="warn-container">
|
|
|
|
* <span>WARNING</span>: If you want to use this parameter to OpenVidu Web Component statically, you have to replace the <strong>camelCase</strong> with a <strong>hyphen between words</strong>.</div>
|
|
|
|
*
|
|
|
|
* @example
|
|
|
|
* <openvidu-webcomponent participant-name="MY_NAME"></openvidu-webcomponent>
|
|
|
|
*/
|
2022-03-16 14:19:04 +01:00
|
|
|
@Input() set participantName(value: string) {
|
|
|
|
this._participantName = value;
|
|
|
|
}
|
2022-03-25 12:39:24 +01:00
|
|
|
/**
|
|
|
|
* The **prejoin** attribute allows show/hide the prejoin page for selecting media devices.
|
|
|
|
*
|
|
|
|
* Default: `true`
|
|
|
|
*
|
|
|
|
* @example
|
|
|
|
* <openvidu-webcomponent prejoin="false"></openvidu-webcomponent>
|
|
|
|
*/
|
2022-03-11 12:11:41 +01:00
|
|
|
@Input() set prejoin(value: string | boolean) {
|
|
|
|
this._prejoin = this.castToBoolean(value);
|
|
|
|
}
|
2022-03-25 12:39:24 +01:00
|
|
|
/**
|
|
|
|
* The **videoMuted** attribute allows to join the session with camera muted/unmuted.
|
|
|
|
*
|
|
|
|
* Default: `false`
|
|
|
|
*
|
|
|
|
* <div class="warn-container">
|
|
|
|
* <span>WARNING</span>: If you want to use this parameter to OpenVidu Web Component statically, you have to replace the <strong>camelCase</strong> with a <strong>hyphen between words</strong>.</div>
|
|
|
|
*
|
|
|
|
* @example
|
|
|
|
* <openvidu-webcomponent video-muted="false"></openvidu-webcomponent>
|
|
|
|
*/
|
2022-03-11 12:11:41 +01:00
|
|
|
@Input() set videoMuted(value: string | boolean) {
|
|
|
|
this._videoMuted = this.castToBoolean(value);
|
|
|
|
}
|
2022-03-25 12:39:24 +01:00
|
|
|
/**
|
|
|
|
* The **audioMuted** attribute allows to join the session with microphone muted/unmuted.
|
|
|
|
*
|
|
|
|
* Default: `false`
|
|
|
|
*
|
|
|
|
* <div class="warn-container">
|
|
|
|
* <span>WARNING</span>: If you want to use this parameter to OpenVidu Web Component statically, you have to replace the <strong>camelCase</strong> with a <strong>hyphen between words</strong>.</div>
|
|
|
|
*
|
|
|
|
* @example
|
|
|
|
* <openvidu-webcomponent audio-muted="false"></openvidu-webcomponent>
|
|
|
|
*/
|
2022-03-11 12:11:41 +01:00
|
|
|
@Input() set audioMuted(value: string | boolean) {
|
|
|
|
this._audioMuted = this.castToBoolean(value);
|
|
|
|
}
|
|
|
|
|
2022-03-25 12:39:24 +01:00
|
|
|
/**
|
|
|
|
* The **toolbarScreenshareButton** attribute allows show/hide the screenshare toolbar button.
|
|
|
|
*
|
|
|
|
* Default: `true`
|
|
|
|
*
|
|
|
|
* <div class="warn-container">
|
|
|
|
* <span>WARNING</span>: If you want to use this parameter to OpenVidu Web Component statically, you have to replace the <strong>camelCase</strong> with a <strong>hyphen between words</strong>.</div>
|
|
|
|
*
|
|
|
|
* @example
|
|
|
|
* <openvidu-webcomponent toolbar-screenshare-button="false"></openvidu-webcomponent>
|
|
|
|
*/
|
2022-03-11 12:11:41 +01:00
|
|
|
@Input() set toolbarScreenshareButton(value: string | boolean) {
|
|
|
|
this._toolbarScreenshareButton = this.castToBoolean(value);
|
|
|
|
}
|
2022-03-25 12:39:24 +01:00
|
|
|
/**
|
|
|
|
* The **toolbarFullscreenButton** attribute allows show/hide the fullscreen toolbar button.
|
|
|
|
*
|
|
|
|
* Default: `true`
|
|
|
|
*
|
|
|
|
* <div class="warn-container">
|
|
|
|
* <span>WARNING</span>: If you want to use this parameter to OpenVidu Web Component statically, you have to replace the <strong>camelCase</strong> with a <strong>hyphen between words</strong>.</div>
|
|
|
|
*
|
|
|
|
* @example
|
|
|
|
* <openvidu-webcomponent toolbar-fullscreen-button="false"></openvidu-webcomponent>
|
|
|
|
*/
|
2022-03-11 12:11:41 +01:00
|
|
|
@Input() set toolbarFullscreenButton(value: string | boolean) {
|
|
|
|
this._toolbarFullscreenButton = this.castToBoolean(value);
|
|
|
|
}
|
2022-03-25 12:39:24 +01:00
|
|
|
/**
|
|
|
|
* The **toolbarLeaveButton** attribute allows show/hide the leave toolbar button.
|
|
|
|
*
|
|
|
|
* Default: `true`
|
|
|
|
*
|
|
|
|
* <div class="warn-container">
|
|
|
|
* <span>WARNING</span>: If you want to use this parameter to OpenVidu Web Component statically, you have to replace the <strong>camelCase</strong> with a <strong>hyphen between words</strong>.</div>
|
|
|
|
*
|
|
|
|
* @example
|
|
|
|
* <openvidu-webcomponent toolbar-leave-button="false"></openvidu-webcomponent>
|
|
|
|
*/
|
2022-03-11 12:11:41 +01:00
|
|
|
@Input() set toolbarLeaveButton(value: string | boolean) {
|
|
|
|
this._toolbarLeaveButton = this.castToBoolean(value);
|
|
|
|
}
|
2022-03-25 12:39:24 +01:00
|
|
|
/**
|
|
|
|
* The **toolbarChatPanelButton** attribute allows show/hide the chat panel toolbar button.
|
|
|
|
*
|
|
|
|
* Default: `true`
|
|
|
|
*
|
|
|
|
* <div class="warn-container">
|
|
|
|
* <span>WARNING</span>: If you want to use this parameter to OpenVidu Web Component statically, you have to replace the <strong>camelCase</strong> with a <strong>hyphen between words</strong>.</div>
|
|
|
|
*
|
|
|
|
* @example
|
|
|
|
* <openvidu-webcomponent toolbar-chat-panel-button="false"></openvidu-webcomponent>
|
|
|
|
*/
|
2022-03-11 12:11:41 +01:00
|
|
|
@Input() set toolbarChatPanelButton(value: string | boolean) {
|
|
|
|
this._toolbarChatPanelButton = this.castToBoolean(value);
|
|
|
|
}
|
2022-03-25 12:39:24 +01:00
|
|
|
/**
|
|
|
|
* The **toolbarParticipantsPanelButton** attribute allows show/hide the participants panel toolbar button.
|
|
|
|
*
|
|
|
|
* Default: `true`
|
|
|
|
*
|
|
|
|
* <div class="warn-container">
|
|
|
|
* <span>WARNING</span>: If you want to use this parameter to OpenVidu Web Component statically, you have to replace the <strong>camelCase</strong> with a <strong>hyphen between words</strong>.</div>
|
|
|
|
*
|
|
|
|
* @example
|
|
|
|
* <openvidu-webcomponent toolbar-participants-panel-button="false"></openvidu-webcomponent>
|
|
|
|
*/
|
2022-03-11 12:11:41 +01:00
|
|
|
@Input() set toolbarParticipantsPanelButton(value: string | boolean) {
|
|
|
|
this._toolbarParticipantsPanelButton = this.castToBoolean(value);
|
|
|
|
}
|
2022-03-25 12:39:24 +01:00
|
|
|
/**
|
|
|
|
* The **toolbarDisplayLogo** attribute allows show/hide the branding logo.
|
|
|
|
*
|
|
|
|
* Default: `true`
|
|
|
|
*
|
|
|
|
* <div class="warn-container">
|
|
|
|
* <span>WARNING</span>: If you want to use this parameter to OpenVidu Web Component statically, you have to replace the <strong>camelCase</strong> with a <strong>hyphen between words</strong>.</div>
|
|
|
|
*
|
|
|
|
* @example
|
|
|
|
* <openvidu-webcomponent toolbar-display-logo="false"></openvidu-webcomponent>
|
|
|
|
*/
|
2022-03-11 12:11:41 +01:00
|
|
|
@Input() set toolbarDisplayLogo(value: string | boolean) {
|
|
|
|
this._toolbarDisplayLogo = this.castToBoolean(value);
|
|
|
|
}
|
2022-03-25 12:39:24 +01:00
|
|
|
/**
|
|
|
|
* The **toolbarDisplaySessionName** attribute allows show/hide the session name.
|
|
|
|
*
|
|
|
|
* Default: `true`
|
|
|
|
*
|
|
|
|
* <div class="warn-container">
|
|
|
|
* <span>WARNING</span>: If you want to use this parameter to OpenVidu Web Component statically, you have to replace the <strong>camelCase</strong> with a <strong>hyphen between words</strong>.</div>
|
|
|
|
*
|
|
|
|
* @example
|
|
|
|
* <openvidu-webcomponent toolbar-display-session-name="false"></openvidu-webcomponent>
|
|
|
|
*/
|
2022-03-11 12:11:41 +01:00
|
|
|
@Input() set toolbarDisplaySessionName(value: string | boolean) {
|
|
|
|
this._toolbarDisplaySessionName = this.castToBoolean(value);
|
|
|
|
}
|
2022-03-25 12:39:24 +01:00
|
|
|
/**
|
|
|
|
* The **streamDisplayParticipantName** attribute allows show/hide the participants name in stream component.
|
|
|
|
*
|
|
|
|
* Default: `true`
|
|
|
|
*
|
|
|
|
* <div class="warn-container">
|
|
|
|
* <span>WARNING</span>: If you want to use this parameter to OpenVidu Web Component statically, you have to replace the <strong>camelCase</strong> with a <strong>hyphen between words</strong>.</div>
|
|
|
|
*
|
|
|
|
* @example
|
|
|
|
* <openvidu-webcomponent stream-display-participant-name="false"></openvidu-webcomponent>
|
|
|
|
*/
|
2022-03-11 12:11:41 +01:00
|
|
|
@Input() set streamDisplayParticipantName(value: string | boolean) {
|
|
|
|
this._streamDisplayParticipantName = this.castToBoolean(value);
|
|
|
|
}
|
2022-03-25 12:39:24 +01:00
|
|
|
/**
|
|
|
|
* The **streamDisplayAudioDetection** attribute allows show/hide the participants audio detection in stream component.
|
|
|
|
*
|
|
|
|
* Default: `true`
|
|
|
|
*
|
|
|
|
* <div class="warn-container">
|
|
|
|
* <span>WARNING</span>: If you want to use this parameter to OpenVidu Web Component statically, you have to replace the <strong>camelCase</strong> with a <strong>hyphen between words</strong>.</div>
|
|
|
|
*
|
|
|
|
* @example
|
|
|
|
* <openvidu-webcomponent stream-display-audio-detection="false"></openvidu-webcomponent>
|
|
|
|
*/
|
2022-03-11 12:11:41 +01:00
|
|
|
@Input() set streamDisplayAudioDetection(value: string | boolean) {
|
|
|
|
this._streamDisplayAudioDetection = this.castToBoolean(value);
|
|
|
|
}
|
2022-03-25 12:39:24 +01:00
|
|
|
/**
|
|
|
|
* The **streamSettingsButton** attribute allows show/hide the participants settings button in stream component.
|
|
|
|
*
|
|
|
|
* Default: `true`
|
|
|
|
*
|
|
|
|
* <div class="warn-container">
|
|
|
|
* <span>WARNING</span>: If you want to use this parameter to OpenVidu Web Component statically, you have to replace the <strong>camelCase</strong> with a <strong>hyphen between words</strong>.</div>
|
|
|
|
*
|
|
|
|
* @example
|
|
|
|
* <openvidu-webcomponent stream-settings-button="false"></openvidu-webcomponent>
|
|
|
|
*/
|
2022-03-11 12:11:41 +01:00
|
|
|
@Input() set streamSettingsButton(value: string | boolean) {
|
|
|
|
this._streamSettingsButton = this.castToBoolean(value);
|
|
|
|
}
|
2022-03-25 12:39:24 +01:00
|
|
|
/**
|
|
|
|
* The **participantPanelItemMuteButton** attribute allows show/hide the muted button in participant panel item component.
|
|
|
|
*
|
|
|
|
* Default: `true`
|
|
|
|
*
|
|
|
|
* <div class="warn-container">
|
|
|
|
* <span>WARNING</span>: If you want to use this parameter to OpenVidu Web Component statically, you have to replace the <strong>camelCase</strong> with a <strong>hyphen between words</strong>.</div>
|
|
|
|
*
|
|
|
|
* @example
|
|
|
|
* <openvidu-webcomponent participant-panel-item-mute-button="false"></openvidu-webcomponent>
|
|
|
|
*/
|
2022-03-11 12:11:41 +01:00
|
|
|
@Input() set participantPanelItemMuteButton(value: string | boolean) {
|
|
|
|
this._participantPanelItemMuteButton = this.castToBoolean(value);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Output() onJoinButtonClicked = new EventEmitter<any>();
|
|
|
|
@Output() onToolbarLeaveButtonClicked = new EventEmitter<any>();
|
|
|
|
@Output() onToolbarCameraButtonClicked = new EventEmitter<any>();
|
|
|
|
@Output() onToolbarMicrophoneButtonClicked = new EventEmitter<any>();
|
|
|
|
@Output() onToolbarScreenshareButtonClicked = new EventEmitter<any>();
|
|
|
|
@Output() onToolbarParticipantsPanelButtonClicked = new EventEmitter<any>();
|
|
|
|
@Output() onToolbarChatPanelButtonClicked = new EventEmitter<any>();
|
|
|
|
@Output() onToolbarFullscreenButtonClicked = new EventEmitter<any>();
|
2022-03-16 16:34:55 +01:00
|
|
|
@Output() onSessionCreated = new EventEmitter<any>();
|
|
|
|
@Output() onParticipantCreated = new EventEmitter<any>();
|
2022-01-24 11:18:23 +01:00
|
|
|
|
2022-03-23 13:48:17 +01:00
|
|
|
/**
|
|
|
|
* @internal
|
|
|
|
*/
|
2022-03-16 14:19:04 +01:00
|
|
|
success: boolean = false;
|
2022-03-11 12:11:41 +01:00
|
|
|
private log: ILogger;
|
2022-01-24 11:18:23 +01:00
|
|
|
|
2022-03-23 13:48:17 +01:00
|
|
|
/**
|
|
|
|
* @internal
|
|
|
|
*/
|
2022-03-11 12:11:41 +01:00
|
|
|
constructor(private loggerService: LoggerService, private host: ElementRef, private openviduService: OpenViduService) {
|
|
|
|
this.log = this.loggerService.get('WebComponent');
|
2022-04-07 09:51:23 +02:00
|
|
|
this.host.nativeElement.disconnect = this.disconnect.bind(this);
|
2022-03-11 12:11:41 +01:00
|
|
|
}
|
2022-01-24 11:18:23 +01:00
|
|
|
|
|
|
|
ngOnInit(): void {}
|
|
|
|
|
2022-03-25 12:39:24 +01:00
|
|
|
/**
|
|
|
|
* @example
|
|
|
|
* <openvidu-webcomponent tokens='{"webcam":"TOKEN1", "screen":"TOKEN2"}'></openvidu-webcomponent>
|
|
|
|
*/
|
2022-03-16 14:19:04 +01:00
|
|
|
@Input('tokens')
|
|
|
|
set tokens(value: TokenModel | string) {
|
|
|
|
this.log.d('Webcomponent tokens: ', value);
|
|
|
|
try {
|
|
|
|
this._tokens = this.castToJson(value);
|
|
|
|
this.success = !!this._tokens?.webcam && !!this._tokens?.screen;
|
|
|
|
} catch (error) {
|
|
|
|
this.log.e(error);
|
|
|
|
if (!this.success) {
|
|
|
|
this.log.e('Parameters received are incorrect: ', value);
|
|
|
|
this.log.e('Session cannot start');
|
|
|
|
}
|
2022-01-24 11:18:23 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-03-23 13:48:17 +01:00
|
|
|
/**
|
|
|
|
* @internal
|
|
|
|
*/
|
2022-03-11 12:11:41 +01:00
|
|
|
_onJoinButtonClicked() {
|
|
|
|
this.onJoinButtonClicked.emit();
|
|
|
|
}
|
|
|
|
|
2022-03-23 13:48:17 +01:00
|
|
|
/**
|
|
|
|
* @internal
|
|
|
|
*/
|
2022-03-11 12:11:41 +01:00
|
|
|
_onToolbarLeaveButtonClicked() {
|
2022-03-23 13:48:17 +01:00
|
|
|
this.success = false;
|
2022-03-11 12:11:41 +01:00
|
|
|
this.onToolbarLeaveButtonClicked.emit();
|
|
|
|
}
|
|
|
|
|
2022-03-23 13:48:17 +01:00
|
|
|
/**
|
|
|
|
* @internal
|
|
|
|
*/
|
2022-03-11 12:11:41 +01:00
|
|
|
_onToolbarCameraButtonClicked() {
|
|
|
|
this.onToolbarCameraButtonClicked.emit();
|
|
|
|
}
|
|
|
|
|
2022-03-23 13:48:17 +01:00
|
|
|
/**
|
|
|
|
* @internal
|
|
|
|
*/
|
2022-03-11 12:11:41 +01:00
|
|
|
_onToolbarMicrophoneButtonClicked() {
|
|
|
|
this.onToolbarMicrophoneButtonClicked.emit();
|
|
|
|
}
|
2022-03-23 13:48:17 +01:00
|
|
|
/**
|
|
|
|
* @internal
|
|
|
|
*/
|
2022-03-16 14:19:04 +01:00
|
|
|
_onToolbarScreenshareButtonClicked() {
|
2022-03-11 12:11:41 +01:00
|
|
|
this.onToolbarScreenshareButtonClicked.emit();
|
|
|
|
}
|
2022-03-23 13:48:17 +01:00
|
|
|
/**
|
|
|
|
* @internal
|
|
|
|
*/
|
2022-03-16 14:19:04 +01:00
|
|
|
_onToolbarParticipantsPanelButtonClicked() {
|
2022-03-11 12:11:41 +01:00
|
|
|
this.onToolbarParticipantsPanelButtonClicked.emit();
|
|
|
|
}
|
2022-03-23 13:48:17 +01:00
|
|
|
/**
|
|
|
|
* @internal
|
|
|
|
*/
|
2022-03-16 14:19:04 +01:00
|
|
|
_onToolbarChatPanelButtonClicked() {
|
2022-03-11 12:11:41 +01:00
|
|
|
this.onToolbarChatPanelButtonClicked.emit();
|
|
|
|
}
|
2022-03-23 13:48:17 +01:00
|
|
|
/**
|
|
|
|
* @internal
|
|
|
|
*/
|
2022-03-16 14:19:04 +01:00
|
|
|
_onToolbarFullscreenButtonClicked() {
|
2022-03-11 12:11:41 +01:00
|
|
|
this.onToolbarFullscreenButtonClicked.emit();
|
|
|
|
}
|
2022-03-23 13:48:17 +01:00
|
|
|
/**
|
|
|
|
* @internal
|
|
|
|
*/
|
2022-03-11 12:11:41 +01:00
|
|
|
_onSessionCreated(event: Session) {
|
|
|
|
this.onSessionCreated.emit(event);
|
|
|
|
}
|
2022-01-25 12:02:50 +01:00
|
|
|
|
2022-03-23 13:48:17 +01:00
|
|
|
/**
|
|
|
|
* @internal
|
|
|
|
*/
|
2022-03-16 16:34:55 +01:00
|
|
|
_onParticipantCreated(event: ParticipantAbstractModel) {
|
|
|
|
this.onParticipantCreated.emit(event);
|
|
|
|
}
|
|
|
|
|
2022-04-07 09:51:23 +02:00
|
|
|
disconnect() {
|
2022-03-11 12:11:41 +01:00
|
|
|
this.openviduService.disconnect();
|
|
|
|
}
|
2022-01-24 11:18:23 +01:00
|
|
|
|
2022-03-11 12:11:41 +01:00
|
|
|
private castToBoolean(value: string | boolean): boolean {
|
|
|
|
if (typeof value === 'boolean') {
|
|
|
|
return value;
|
|
|
|
} else if (typeof value === 'string') {
|
|
|
|
if (value !== 'true' && value !== 'false') {
|
|
|
|
throw new Error('Parameter has an incorrect string value.');
|
|
|
|
}
|
|
|
|
return value === 'true';
|
|
|
|
} else {
|
|
|
|
throw new Error('Parameter has not a valid type. The parameters must to be string or boolean.');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-03-16 14:19:04 +01:00
|
|
|
private castToJson(value: TokenModel | string) {
|
2022-03-11 12:11:41 +01:00
|
|
|
if (typeof value === 'string') {
|
|
|
|
try {
|
|
|
|
return JSON.parse(value);
|
|
|
|
} catch (error) {
|
|
|
|
this.log.e('Unexpected JSON', error);
|
|
|
|
throw 'Unexpected JSON';
|
|
|
|
}
|
|
|
|
} else if (typeof value === 'object') {
|
|
|
|
return value;
|
|
|
|
} else {
|
2022-03-16 14:19:04 +01:00
|
|
|
throw new Error(
|
|
|
|
'Parameter has not a valid type. The parameters must to be string or TokenModel {webcam:string, screen: string}.'
|
|
|
|
);
|
2022-03-11 12:11:41 +01:00
|
|
|
}
|
|
|
|
}
|
2022-01-24 11:18:23 +01:00
|
|
|
}
|