From 2deadbbe0229b3ca53624d391f884671ec805aca Mon Sep 17 00:00:00 2001 From: csantosm <4a.santos@gmail.com> Date: Mon, 18 Apr 2022 16:39:23 +0200 Subject: [PATCH] openvidu-components: Added event types --- .../components/toolbar/toolbar.component.ts | 62 ++++++++++++---- .../videoconference.component.ts | 74 +++++++++++++------ .../openvidu-webcomponent.component.ts | 68 +++++++++++++---- 3 files changed, 150 insertions(+), 54 deletions(-) diff --git a/openvidu-components-angular/projects/openvidu-angular/src/lib/components/toolbar/toolbar.component.ts b/openvidu-components-angular/projects/openvidu-angular/src/lib/components/toolbar/toolbar.component.ts index a034d68d..4b80cb64 100644 --- a/openvidu-components-angular/projects/openvidu-angular/src/lib/components/toolbar/toolbar.component.ts +++ b/openvidu-components-angular/projects/openvidu-angular/src/lib/components/toolbar/toolbar.component.ts @@ -26,7 +26,10 @@ import { ChatMessage } from '../../models/chat.model'; import { ParticipantService } from '../../services/participant/participant.service'; import { PanelType } from '../../models/panel.model'; import { OpenViduAngularConfigService } from '../../services/config/openvidu-angular.config.service'; -import { ToolbarAdditionalButtonsDirective, ToolbarAdditionalPanelButtonsDirective } from '../../directives/template/openvidu-angular.directive'; +import { + ToolbarAdditionalButtonsDirective, + ToolbarAdditionalPanelButtonsDirective +} from '../../directives/template/openvidu-angular.directive'; import { ParticipantAbstractModel } from '../../models/participant.model'; import { PlatformService } from '../../services/platform/platform.service'; @@ -117,22 +120,49 @@ export class ToolbarComponent implements OnInit, OnDestroy { /** * @ignore */ - @ContentChild(ToolbarAdditionalPanelButtonsDirective) - set externalAdditionalPanelButtons(externalAdditionalPanelButtons: ToolbarAdditionalPanelButtonsDirective) { - // This directive will has value only when ADDITIONAL PANEL BUTTONS component tagget with '*ovToolbarAdditionalPanelButtons' directive - // is inside of the TOOLBAR component tagged with '*ovToolbar' directive - if (externalAdditionalPanelButtons) { - this.toolbarAdditionalPanelButtonsTemplate = externalAdditionalPanelButtons.template; - } - } + @ContentChild(ToolbarAdditionalPanelButtonsDirective) + set externalAdditionalPanelButtons(externalAdditionalPanelButtons: ToolbarAdditionalPanelButtonsDirective) { + // This directive will has value only when ADDITIONAL PANEL BUTTONS component tagget with '*ovToolbarAdditionalPanelButtons' directive + // is inside of the TOOLBAR component tagged with '*ovToolbar' directive + if (externalAdditionalPanelButtons) { + this.toolbarAdditionalPanelButtonsTemplate = externalAdditionalPanelButtons.template; + } + } - @Output() onLeaveButtonClicked = new EventEmitter(); - @Output() onCameraButtonClicked = new EventEmitter(); - @Output() onMicrophoneButtonClicked = new EventEmitter(); - @Output() onFullscreenButtonClicked = new EventEmitter(); - @Output() onScreenshareButtonClicked = new EventEmitter(); - @Output() onParticipantsPanelButtonClicked = new EventEmitter(); - @Output() onChatPanelButtonClicked = new EventEmitter(); + /** + * Provides event notifications that fire when leave button has been clicked. + */ + @Output() onLeaveButtonClicked: EventEmitter = new EventEmitter(); + + /** + * Provides event notifications that fire when camera toolbar button has been clicked. + */ + @Output() onCameraButtonClicked: EventEmitter = new EventEmitter(); + + /** + * Provides event notifications that fire when microphone toolbar button has been clicked. + */ + @Output() onMicrophoneButtonClicked: EventEmitter = new EventEmitter(); + + /** + * Provides event notifications that fire when fullscreen toolbar button has been clicked. + */ + @Output() onFullscreenButtonClicked: EventEmitter = new EventEmitter(); + + /** + * Provides event notifications that fire when screenshare toolbar button has been clicked. + */ + @Output() onScreenshareButtonClicked: EventEmitter = new EventEmitter(); + + /** + * Provides event notifications that fire when participants panel button has been clicked. + */ + @Output() onParticipantsPanelButtonClicked: EventEmitter = new EventEmitter(); + + /** + * Provides event notifications that fire when chat panel button has been clicked. + */ + @Output() onChatPanelButtonClicked: EventEmitter = new EventEmitter(); /** * @ignore diff --git a/openvidu-components-angular/projects/openvidu-angular/src/lib/components/videoconference/videoconference.component.ts b/openvidu-components-angular/projects/openvidu-angular/src/lib/components/videoconference/videoconference.component.ts index 60386dd6..742031b6 100644 --- a/openvidu-components-angular/projects/openvidu-angular/src/lib/components/videoconference/videoconference.component.ts +++ b/openvidu-components-angular/projects/openvidu-angular/src/lib/components/videoconference/videoconference.component.ts @@ -26,7 +26,7 @@ import { ToolbarDirective } from '../../directives/template/openvidu-angular.directive'; import { ILogger } from '../../models/logger.model'; -import { ParticipantProperties } from '../../models/participant.model'; +import { ParticipantAbstractModel, ParticipantProperties } from '../../models/participant.model'; import { TokenModel } from '../../models/token.model'; import { ActionService } from '../../services/action/action.service'; import { OpenViduAngularConfigService } from '../../services/config/openvidu-angular.config.service'; @@ -232,10 +232,6 @@ export class VideoconferenceComponent implements OnInit, OnDestroy, AfterViewIni */ openviduAngularStreamTemplate: TemplateRef; - // *** Parameters *** - // @Input() sessionName: string; - // @Input() participantName: string; - /** * @param {TokenModel} tokens The tokens parameter must be an object with `webcam` and `screen` fields. * Both of them are `string` type. See {@link TokenModel} @@ -255,26 +251,56 @@ export class VideoconferenceComponent implements OnInit, OnDestroy, AfterViewIni } } - // *** Events *** + /** + * Provides event notifications that fire when join button (in prejoin page) has been clicked. + */ + @Output() onJoinButtonClicked: EventEmitter = new EventEmitter(); - // Event sent when user click on the join button in pre-join page - @Output() onJoinButtonClicked = new EventEmitter(); - // Event sent when user click on the join button in pre-join page - @Output() onToolbarLeaveButtonClicked = new EventEmitter(); - @Output() onToolbarCameraButtonClicked = new EventEmitter(); - @Output() onToolbarMicrophoneButtonClicked = new EventEmitter(); - @Output() onToolbarScreenshareButtonClicked = new EventEmitter(); - @Output() onToolbarFullscreenButtonClicked = new EventEmitter(); - @Output() onToolbarParticipantsPanelButtonClicked = new EventEmitter(); - @Output() onToolbarChatPanelButtonClicked = new EventEmitter(); + /** + * Provides event notifications that fire when leave button has been clicked. + */ + @Output() onToolbarLeaveButtonClicked: EventEmitter = new EventEmitter(); - // Event sent when participant has joined the session - // @Output() onParticipantJoined = new EventEmitter(); + /** + * Provides event notifications that fire when camera toolbar button has been clicked. + */ + @Output() onToolbarCameraButtonClicked: EventEmitter = new EventEmitter(); - // Event sent when session has been created - @Output() onSessionCreated = new EventEmitter(); - // Event sent when participant has been created - @Output() onParticipantCreated = new EventEmitter(); + /** + * Provides event notifications that fire when microphone toolbar button has been clicked. + */ + @Output() onToolbarMicrophoneButtonClicked: EventEmitter = new EventEmitter(); + + /** + * Provides event notifications that fire when screenshare toolbar button has been clicked. + */ + @Output() onToolbarScreenshareButtonClicked: EventEmitter = new EventEmitter(); + + /** + * Provides event notifications that fire when fullscreen toolbar button has been clicked. + */ + @Output() onToolbarFullscreenButtonClicked: EventEmitter = new EventEmitter(); + + /** + * Provides event notifications that fire when participants panel button has been clicked. + */ + @Output() onToolbarParticipantsPanelButtonClicked: EventEmitter = new EventEmitter(); + + /** + * Provides event notifications that fire when chat panel button has been clicked. + */ + @Output() onToolbarChatPanelButtonClicked: EventEmitter = new EventEmitter(); + + /** + * Provides event notifications that fire when OpenVidu Session is created. + * See {@link https://docs.openvidu.io/en/stable/api/openvidu-browser/classes/Session.html openvidu-browser Session}. + */ + @Output() onSessionCreated: EventEmitter = new EventEmitter(); + + /** + * Provides event notifications that fire when local participant is created. + */ + @Output() onParticipantCreated: EventEmitter = new EventEmitter(); /** * @internal @@ -494,8 +520,8 @@ export class VideoconferenceComponent implements OnInit, OnDestroy, AfterViewIni /** * @internal */ - _onSessionCreated(event: Session) { - this.onSessionCreated.emit(event); + _onSessionCreated(session: Session) { + this.onSessionCreated.emit(session); } private handlePublisherError(e: any) { diff --git a/openvidu-components-angular/src/app/openvidu-webcomponent/openvidu-webcomponent.component.ts b/openvidu-components-angular/src/app/openvidu-webcomponent/openvidu-webcomponent.component.ts index 8c543b61..e8104f01 100644 --- a/openvidu-components-angular/src/app/openvidu-webcomponent/openvidu-webcomponent.component.ts +++ b/openvidu-components-angular/src/app/openvidu-webcomponent/openvidu-webcomponent.component.ts @@ -304,16 +304,56 @@ export class OpenviduWebComponentComponent implements OnInit { this._participantPanelItemMuteButton = this.castToBoolean(value); } - @Output() onJoinButtonClicked = new EventEmitter(); - @Output() onToolbarLeaveButtonClicked = new EventEmitter(); - @Output() onToolbarCameraButtonClicked = new EventEmitter(); - @Output() onToolbarMicrophoneButtonClicked = new EventEmitter(); - @Output() onToolbarScreenshareButtonClicked = new EventEmitter(); - @Output() onToolbarParticipantsPanelButtonClicked = new EventEmitter(); - @Output() onToolbarChatPanelButtonClicked = new EventEmitter(); - @Output() onToolbarFullscreenButtonClicked = new EventEmitter(); - @Output() onSessionCreated = new EventEmitter(); - @Output() onParticipantCreated = new EventEmitter(); + /** + * Provides event notifications that fire when join button (in prejoin page) has been clicked. + */ + @Output() onJoinButtonClicked: EventEmitter = new EventEmitter(); + + /** + * Provides event notifications that fire when leave button has been clicked. + */ + @Output() onToolbarLeaveButtonClicked: EventEmitter = new EventEmitter(); + + /** + * Provides event notifications that fire when camera toolbar button has been clicked. + */ + @Output() onToolbarCameraButtonClicked: EventEmitter = new EventEmitter(); + + /** + * Provides event notifications that fire when microphone toolbar button has been clicked. + */ + @Output() onToolbarMicrophoneButtonClicked: EventEmitter = new EventEmitter(); + + /** + * Provides event notifications that fire when screenshare toolbar button has been clicked. + */ + @Output() onToolbarScreenshareButtonClicked: EventEmitter = new EventEmitter(); + + /** + * Provides event notifications that fire when fullscreen toolbar button has been clicked. + */ + @Output() onToolbarFullscreenButtonClicked: EventEmitter = new EventEmitter(); + + /** + * Provides event notifications that fire when participants panel button has been clicked. + */ + @Output() onToolbarParticipantsPanelButtonClicked: EventEmitter = new EventEmitter(); + + /** + * Provides event notifications that fire when chat panel button has been clicked. + */ + @Output() onToolbarChatPanelButtonClicked: EventEmitter = new EventEmitter(); + + /** + * Provides event notifications that fire when OpenVidu Session is created. + * See {@link https://docs.openvidu.io/en/stable/api/openvidu-browser/classes/Session.html openvidu-browser Session}. + */ + @Output() onSessionCreated: EventEmitter = new EventEmitter(); + + /** + * Provides event notifications that fire when local participant is created. + */ + @Output() onParticipantCreated: EventEmitter = new EventEmitter(); /** * @internal @@ -405,15 +445,15 @@ export class OpenviduWebComponentComponent implements OnInit { /** * @internal */ - _onSessionCreated(event: Session) { - this.onSessionCreated.emit(event); + _onSessionCreated(session: Session) { + this.onSessionCreated.emit(session); } /** * @internal */ - _onParticipantCreated(event: ParticipantAbstractModel) { - this.onParticipantCreated.emit(event); + _onParticipantCreated(participant: ParticipantAbstractModel) { + this.onParticipantCreated.emit(participant); } disconnect() {