mirror of https://github.com/OpenVidu/openvidu.git
openvidu-browser: new event documentation
parent
58edee6b97
commit
c30091ee06
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* (C) Copyright 2017-2020 OpenVidu (https://openvidu.io)
|
||||
* (C) Copyright 2017-2022 OpenVidu (https://openvidu.io)
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -16,8 +16,7 @@
|
|||
*/
|
||||
|
||||
import { Event as Event } from '../OpenViduInternal/Events/Event';
|
||||
import { SessionEventMap } from '../OpenViduInternal/Events/EventMap/SessionEventMap';
|
||||
import { StreamManagerEventMap } from '../OpenViduInternal/Events/EventMap/StreamManagerEventMap';
|
||||
import { EventMap } from '../OpenViduInternal/Events/EventMap/EventMap';
|
||||
|
||||
import EventEmitter = require('wolfy87-eventemitter');
|
||||
import { OpenViduLogger } from '../OpenViduInternal/Logger/OpenViduLogger';
|
||||
|
@ -43,21 +42,21 @@ export abstract class EventDispatcher {
|
|||
*
|
||||
* @returns The EventDispatcher object
|
||||
*/
|
||||
abstract on<K extends keyof (SessionEventMap | StreamManagerEventMap)>(type: K, handler: (event: (SessionEventMap | StreamManagerEventMap)[K]) => void): this;
|
||||
abstract on<K extends keyof (EventMap)>(type: K, handler: (event: (EventMap)[K]) => void): this;
|
||||
|
||||
/**
|
||||
* Adds function `handler` to handle event `type` just once. The handler will be automatically removed after first execution
|
||||
*
|
||||
* @returns The object that dispatched the event
|
||||
*/
|
||||
abstract once<K extends keyof (SessionEventMap | StreamManagerEventMap)>(type: K, handler: (event: (SessionEventMap | StreamManagerEventMap)[K]) => void): this;
|
||||
abstract once<K extends keyof (EventMap)>(type: K, handler: (event: (EventMap)[K]) => void): this;
|
||||
|
||||
/**
|
||||
* Removes a `handler` from event `type`. If no handler is provided, all handlers will be removed from the event
|
||||
*
|
||||
* @returns The object that dispatched the event
|
||||
*/
|
||||
abstract off<K extends keyof (SessionEventMap | StreamManagerEventMap)>(type: K, handler?: (event: (SessionEventMap | StreamManagerEventMap)[K]) => void): this;
|
||||
abstract off<K extends keyof (EventMap)>(type: K, handler?: (event: (EventMap)[K]) => void): this;
|
||||
|
||||
/**
|
||||
* @hidden
|
||||
|
|
|
@ -39,17 +39,9 @@ const logger: OpenViduLogger = OpenViduLogger.getInstance();
|
|||
let platform: PlatformUtils;
|
||||
|
||||
/**
|
||||
* Packs local media streams. Participants can publish it to a session. Initialized with [[OpenVidu.initPublisher]] method
|
||||
* Packs local media streams. Participants can publish it to a session. Initialized with [[OpenVidu.initPublisher]] method.
|
||||
*
|
||||
* ### Available event listeners (and events dispatched)
|
||||
*
|
||||
* - accessAllowed
|
||||
* - accessDenied
|
||||
* - accessDialogOpened
|
||||
* - accessDialogClosed
|
||||
* - streamCreated ([[StreamEvent]])
|
||||
* - streamDestroyed ([[StreamEvent]])
|
||||
* - _All events inherited from [[StreamManager]] class_
|
||||
* See available event listeners at [[PublisherEventMap]].
|
||||
*/
|
||||
export class Publisher extends StreamManager {
|
||||
|
||||
|
|
|
@ -67,24 +67,7 @@ let platform: PlatformUtils;
|
|||
* Participants who publish their videos to a session can be seen by the rest of users connected to that specific session.
|
||||
* Initialized with [[OpenVidu.initSession]] method.
|
||||
*
|
||||
* ### Available event listeners (and events dispatched)
|
||||
*
|
||||
* - connectionCreated ([[ConnectionEvent]])
|
||||
* - connectionDestroyed ([[ConnectionEvent]])
|
||||
* - connectionPropertyChanged ([[ConnectionPropertyChangedEvent]]) <a href="https://docs.openvidu.io/en/stable/openvidu-pro/" target="_blank" style="display: inline-block; background-color: rgb(0, 136, 170); color: white; font-weight: bold; padding: 0px 5px; margin-right: 5px; border-radius: 3px; font-size: 13px; line-height:21px; font-family: Montserrat, sans-serif">PRO</a>
|
||||
* - sessionDisconnected ([[SessionDisconnectedEvent]])
|
||||
* - streamCreated ([[StreamEvent]])
|
||||
* - streamDestroyed ([[StreamEvent]])
|
||||
* - streamPropertyChanged ([[StreamPropertyChangedEvent]])
|
||||
* - publisherStartSpeaking ([[PublisherSpeakingEvent]])
|
||||
* - publisherStopSpeaking ([[PublisherSpeakingEvent]])
|
||||
* - signal ([[SignalEvent]])
|
||||
* - recordingStarted ([[RecordingEvent]])
|
||||
* - recordingStopped ([[RecordingEvent]])
|
||||
* - networkQualityLevelChanged ([[NetworkQualityLevelChangedEvent]])
|
||||
* - reconnecting
|
||||
* - reconnected
|
||||
* - exception ([[ExceptionEvent]])
|
||||
* See available event listeners at [[SessionEventMap]].
|
||||
*/
|
||||
export class Session extends EventDispatcher {
|
||||
|
||||
|
|
|
@ -45,16 +45,7 @@ let platform: PlatformUtils;
|
|||
* want to directly manage your own video elements (even more than one video element per Stream). This scenario is pretty common in
|
||||
* declarative, MVC frontend frameworks such as Angular, React or Vue.js
|
||||
*
|
||||
* ### Available event listeners (and events dispatched)
|
||||
*
|
||||
* - videoElementCreated ([[VideoElementEvent]])
|
||||
* - videoElementDestroyed ([[VideoElementEvent]])
|
||||
* - streamPlaying ([[StreamManagerEvent]])
|
||||
* - streamPropertyChanged ([[StreamPropertyChangedEvent]])
|
||||
* - publisherStartSpeaking ([[PublisherSpeakingEvent]])
|
||||
* - publisherStopSpeaking ([[PublisherSpeakingEvent]])
|
||||
* - streamAudioVolumeChange ([[StreamManagerEvent]])
|
||||
*
|
||||
* See available event listeners at [[StreamManagerEventMap]].
|
||||
*/
|
||||
export class StreamManager extends EventDispatcher {
|
||||
|
||||
|
|
|
@ -28,9 +28,7 @@ const logger: OpenViduLogger = OpenViduLogger.getInstance();
|
|||
/**
|
||||
* Packs remote media streams. Participants automatically receive them when others publish their streams. Initialized with [[Session.subscribe]] method
|
||||
*
|
||||
* ### Available event listeners (and events dispatched)
|
||||
*
|
||||
* - _All events inherited from [[StreamManager]] class_
|
||||
* See available event listeners at [[StreamManagerEventMap]].
|
||||
*/
|
||||
export class Subscriber extends StreamManager {
|
||||
|
||||
|
|
|
@ -21,9 +21,9 @@ import { Session } from '../../OpenVidu/Session';
|
|||
|
||||
|
||||
/**
|
||||
* Defines the following events:
|
||||
* - `connectionCreated`: dispatched by [[Session]] after a new user has connected to the session
|
||||
* - `connectionDestroyed`: dispatched by [[Session]] after a new user has left the session
|
||||
* Triggered by:
|
||||
* - [[connectionCreated]]
|
||||
* - [[connectionDestroyed]]
|
||||
*/
|
||||
export class ConnectionEvent extends Event {
|
||||
|
||||
|
|
|
@ -22,15 +22,7 @@ import { Event } from './Event';
|
|||
/**
|
||||
* **This feature is part of OpenVidu Pro tier** <a href="https://docs.openvidu.io/en/stable/openvidu-pro/" target="_blank" style="display: inline-block; background-color: rgb(0, 136, 170); color: white; font-weight: bold; padding: 0px 5px; margin-right: 5px; border-radius: 3px; font-size: 13px; line-height:21px; font-family: Montserrat, sans-serif">PRO</a>
|
||||
*
|
||||
* Defines event `connectionPropertyChanged` dispatched by [[Session]] object.
|
||||
* This event is fired when any property of the local [[Connection]] object changes.
|
||||
* The properties that may change are [[Connection.role]] and [[Connection.record]].
|
||||
*
|
||||
* The only way the Connection properties may change is by updating them through:
|
||||
*
|
||||
* - [API REST](/en/stable/reference-docs/REST-API/#patch-connection)
|
||||
* - [openvidu-java-client](/en/stable/reference-docs/openvidu-java-client/#update-a-connection)
|
||||
* - [openvidu-node-client](/en/stable/reference-docs/openvidu-node-client/#update-a-connection)<br><br>
|
||||
* Triggered by [[connectionPropertyChanged]]
|
||||
*/
|
||||
export class ConnectionPropertyChangedEvent extends Event {
|
||||
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
/*
|
||||
* (C) Copyright 2017-2022 OpenVidu (https://openvidu.io)
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* All OpenVidu Browser events inherit from this interface
|
||||
*/
|
||||
export interface EventMap { }
|
|
@ -1,11 +1,71 @@
|
|||
/*
|
||||
* (C) Copyright 2017-2022 OpenVidu (https://openvidu.io)
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
import { StreamEvent } from '../StreamEvent';
|
||||
import { StreamManagerEventMap } from './StreamManagerEventMap';
|
||||
|
||||
/**
|
||||
* Events dispatched by [[Publisher]] object. Manage event listeners with
|
||||
* [[Publisher.on]], [[Publisher.once]] and [[Publisher.off]] methods.
|
||||
*/
|
||||
export interface PublisherEventMap extends StreamManagerEventMap {
|
||||
|
||||
/**
|
||||
* Event dispatched when the [[Publisher]] has been published to the session (see [[Session.publish]]).
|
||||
*/
|
||||
streamCreated: StreamEvent;
|
||||
|
||||
/**
|
||||
* Event dispatched when the [[Publisher]] has been unpublished from the session.
|
||||
*/
|
||||
streamDestroyed: StreamEvent;
|
||||
|
||||
/**
|
||||
* Event dispatched when a Publisher tries to access some media input device and has the required permissions to do so.
|
||||
*
|
||||
* This happens when calling [[OpenVidu.initPublisher]] or [[OpenVidu.initPublisherAsync]] and the application
|
||||
* has permissions to use the devices. This usually means the user has accepted the permissions dialog that the
|
||||
* browser will show when trying to access the camera/microphone/screen.
|
||||
*/
|
||||
accessAllowed: never;
|
||||
|
||||
/**
|
||||
* Event dispatched when a Publisher tries to access some media input device and does NOT have the required permissions to do so.
|
||||
*
|
||||
* This happens when calling [[OpenVidu.initPublisher]] or [[OpenVidu.initPublisherAsync]] and the application
|
||||
* lacks the required permissions to use the devices. This usually means the user has NOT accepted the permissions dialog that the
|
||||
* browser will show when trying to access the camera/microphone/screen.
|
||||
*/
|
||||
accessDenied: never;
|
||||
|
||||
/**
|
||||
* Event dispatched when the pop-up shown by the browser to request permissions for the input media devices is opened.
|
||||
*
|
||||
* You can use this event to alert the user about granting permissions for your website. Note that this event is artificially
|
||||
* generated based only on time intervals when accessing media devices. A heavily overloaded client device that simply takes more
|
||||
* than usual to access the media device could produce a false trigger of this event.
|
||||
*/
|
||||
accessDialogOpened: never;
|
||||
|
||||
/**
|
||||
* Event dispatched after the user clicks on "Allow" or "Block" in the pop-up shown by the browser to request permissions
|
||||
* for the input media devices.
|
||||
*
|
||||
* This event can only be triggered after an [[accessDialogOpened]] event has been previously triggered.
|
||||
*/
|
||||
accessDialogClosed: never;
|
||||
}
|
|
@ -1,3 +1,21 @@
|
|||
/*
|
||||
* (C) Copyright 2017-2022 OpenVidu (https://openvidu.io)
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
import { EventMap } from './EventMap';
|
||||
import { ConnectionEvent } from '../ConnectionEvent';
|
||||
import { ConnectionPropertyChangedEvent } from '../ConnectionPropertyChangedEvent';
|
||||
import { ExceptionEvent } from '../ExceptionEvent';
|
||||
|
@ -9,25 +27,148 @@ import { SignalEvent } from '../SignalEvent';
|
|||
import { StreamEvent } from '../StreamEvent';
|
||||
import { StreamPropertyChangedEvent } from '../StreamPropertyChangedEvent';
|
||||
|
||||
export interface SessionEventMap {
|
||||
/**
|
||||
* Events dispatched by [[Session]] object. Manage event listeners with
|
||||
* [[Session.on]], [[Session.once]] and [[Session.off]] methods.
|
||||
*/
|
||||
export interface SessionEventMap extends EventMap {
|
||||
|
||||
/**
|
||||
* Event dispatched when a new user has connected to the session.
|
||||
*
|
||||
* It is fired for both the local user and remote users.
|
||||
*/
|
||||
connectionCreated: ConnectionEvent;
|
||||
|
||||
/**
|
||||
* Event dispatched when a remote user has left the session.
|
||||
*
|
||||
* For the local user see [[sessionDisconnected]].
|
||||
*/
|
||||
connectionDestroyed: ConnectionEvent;
|
||||
|
||||
/**
|
||||
* **This feature is part of OpenVidu Pro tier** <a href="https://docs.openvidu.io/en/stable/openvidu-pro/" target="_blank" style="display: inline-block; background-color: rgb(0, 136, 170); color: white; font-weight: bold; padding: 0px 5px; margin-right: 5px; border-radius: 3px; font-size: 13px; line-height:21px; font-family: Montserrat, sans-serif">PRO</a>
|
||||
*
|
||||
* Event dispatched when a property of the local [[Connection]] object changes.
|
||||
*
|
||||
* It is fired only for the local user.
|
||||
*
|
||||
* The properties that may change are [[Connection.role]] and [[Connection.record]].
|
||||
* The only way the Connection properties may change is by updating them through:
|
||||
*
|
||||
* - [API REST](/en/stable/reference-docs/REST-API/#patch-connection)
|
||||
* - [openvidu-java-client](/en/stable/reference-docs/openvidu-java-client/#update-a-connection)
|
||||
* - [openvidu-node-client](/en/stable/reference-docs/openvidu-node-client/#update-a-connection)<br><br>
|
||||
*/
|
||||
connectionPropertyChanged: ConnectionPropertyChangedEvent;
|
||||
|
||||
/**
|
||||
* Event dispatched when the local user has left the session.
|
||||
*
|
||||
* For remote users see [[connectionDestroyed]].
|
||||
*/
|
||||
sessionDisconnected: SessionDisconnectedEvent;
|
||||
|
||||
/**
|
||||
* Event dispatched when a user has started publishing media to the session (see [[Session.publish]]).
|
||||
*
|
||||
* It is fired for both the local user and remote users.
|
||||
*/
|
||||
streamCreated: StreamEvent;
|
||||
|
||||
/**
|
||||
* Event dispatched when a user stops publishing media to the session.
|
||||
*
|
||||
* It is fired for both the local user and remote users.
|
||||
*/
|
||||
streamDestroyed: StreamEvent;
|
||||
|
||||
/**
|
||||
* Event dispatched when a Stream undergoes any change in any of its mutable properties
|
||||
* (see [[StreamPropertyChangedEvent.changedProperty]]).
|
||||
*
|
||||
* It is fired for both remote streams (owned by a [[Subscriber]]) or local streams (owned by a [[Publisher]]).
|
||||
*/
|
||||
streamPropertyChanged: StreamPropertyChangedEvent;
|
||||
|
||||
/**
|
||||
* Event dispatched when a user has started speaking.
|
||||
*
|
||||
* It is fired for both the local user and remote users.
|
||||
*
|
||||
* Extra information:
|
||||
* - This event will only be triggered for **streams that have audio tracks** ([[Stream.hasAudio]] must be true).
|
||||
* - Further configuration can be applied on how the event is dispatched by setting property `publisherSpeakingEventsOptions` in the call of [[OpenVidu.setAdvancedConfiguration]].
|
||||
*/
|
||||
publisherStartSpeaking: PublisherSpeakingEvent;
|
||||
|
||||
/**
|
||||
* Event dispatched when a user has stopped speaking.
|
||||
*
|
||||
* It is fired for both the local user and remote users.
|
||||
*
|
||||
* Extra information:
|
||||
* - This event will only be triggered for **streams that have audio tracks** ([[Stream.hasAudio]] must be true).
|
||||
* - Further configuration can be applied on how the event is dispatched by setting property `publisherSpeakingEventsOptions` in the call of [[OpenVidu.setAdvancedConfiguration]].
|
||||
*/
|
||||
publisherStopSpeaking: PublisherSpeakingEvent;
|
||||
|
||||
/**
|
||||
* @hidden
|
||||
*/
|
||||
[key: `signal:${string}`]: SignalEvent;
|
||||
|
||||
/**
|
||||
* Event dispatched when a signal is received (see [Send text messages between users](/en/stable/cheatsheet/send-messages)).
|
||||
*
|
||||
* If the listener is added as **`signal:TYPE`**, only signals of type **`TYPE`** will trigger the event.
|
||||
*/
|
||||
signal: SignalEvent;
|
||||
|
||||
/**
|
||||
* Event dispatched when the session has started being recorded.
|
||||
*
|
||||
* Property **`OPENVIDU_RECORDING_NOTIFICATION`** of [OpenVidu Server configuration](/en/stable/reference-docs/openvidu-config/)
|
||||
* defines which users should receive this events (by default, only users with role `PUBLISHER` or `MODERATOR`)
|
||||
*/
|
||||
recordingStarted: RecordingEvent;
|
||||
|
||||
/**
|
||||
* Event dispatched when the session has stopped being recorded.
|
||||
*
|
||||
* Property **`OPENVIDU_RECORDING_NOTIFICATION`** of [OpenVidu Server configuration](/en/stable/reference-docs/openvidu-config/)
|
||||
* defines which users should receive this events (by default, only users with role `PUBLISHER` or `MODERATOR`)
|
||||
*/
|
||||
recordingStopped: RecordingEvent;
|
||||
|
||||
/**
|
||||
* **This feature is part of OpenVidu Pro tier** <a href="https://docs.openvidu.io/en/stable/openvidu-pro/" target="_blank" style="display: inline-block; background-color: rgb(0, 136, 170); color: white; font-weight: bold; padding: 0px 5px; margin-right: 5px; border-radius: 3px; font-size: 13px; line-height:21px; font-family: Montserrat, sans-serif">PRO</a>
|
||||
*
|
||||
* Event dispatched when the network quality level of a [[Connection]] changes. See [network quality](/en/stable/advanced-features/network-quality/).
|
||||
*/
|
||||
networkQualityLevelChanged: NetworkQualityLevelChangedEvent;
|
||||
|
||||
/**
|
||||
* Event dispatched when the local user has lost its connection to the session, and starts the automatic reconnection process.
|
||||
*
|
||||
* See [Reconnection events](/en/stable/advanced-features/automatic-reconnection/#reconnection-events).
|
||||
*/
|
||||
reconnecting: never;
|
||||
|
||||
/**
|
||||
* Event dispatched when the local user has successfully recovered its connection to the session after losing it.
|
||||
*
|
||||
* If the connection was recovered but OpenVidu Server already evicted the user due to timeout, then this event will
|
||||
* not be dispatched. A [[sessionDisconnected]] event with reason `networkDisconnect` will be triggered instead.
|
||||
*
|
||||
* See [Reconnection events](/en/stable/advanced-features/automatic-reconnection/#reconnection-events).
|
||||
*/
|
||||
reconnected: never;
|
||||
|
||||
/**
|
||||
* This event acts as a global handler for asynchronous errors that may be triggered for multiple reasons and from multiple origins.
|
||||
* To see the different types of exceptions go to [[ExceptionEventName]].
|
||||
*/
|
||||
exception: ExceptionEvent;
|
||||
}
|
|
@ -1,14 +1,81 @@
|
|||
/*
|
||||
* (C) Copyright 2017-2022 OpenVidu (https://openvidu.io)
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
import { EventMap } from './EventMap';
|
||||
import { PublisherSpeakingEvent } from '../PublisherSpeakingEvent';
|
||||
import { StreamManagerEvent } from '../StreamManagerEvent';
|
||||
import { StreamPropertyChangedEvent } from '../StreamPropertyChangedEvent';
|
||||
import { VideoElementEvent } from '../VideoElementEvent';
|
||||
|
||||
export interface StreamManagerEventMap {
|
||||
/**
|
||||
* Events dispatched by [[StreamManager]] object. Manage event listeners with
|
||||
* [[StreamManager.on]], [[StreamManager.once]] and [[StreamManager.off]] methods.
|
||||
*/
|
||||
export interface StreamManagerEventMap extends EventMap {
|
||||
|
||||
/**
|
||||
* Event dispatched when a new HTML video element has been inserted into DOM by OpenVidu Browser library. See
|
||||
* [Manage video players](/en/stable/cheatsheet/manage-videos) section.
|
||||
*/
|
||||
videoElementCreated: VideoElementEvent;
|
||||
|
||||
/**
|
||||
* Event dispatched when an HTML video element has been removed from DOM by OpenVidu Browser library. See
|
||||
* [Manage video players](/en/stable/cheatsheet/manage-videos) section.
|
||||
*/
|
||||
videoElementDestroyed: VideoElementEvent;
|
||||
|
||||
/**
|
||||
* Event dispatched when the media stream starts playing (one of its videos has media and has begun to play).
|
||||
* This event will be dispatched when these 3 conditions are met:
|
||||
* 1. The StreamManager has no video associated in the DOM.
|
||||
* 2. It is associated to one video.
|
||||
* 3. That video starts playing. Internally the expected Web API event is [HTMLMediaElement.canplay](https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/canplay_event).
|
||||
*/
|
||||
streamPlaying: StreamManagerEvent;
|
||||
|
||||
/**
|
||||
* Event dispatched when the volume of the media stream's audio track changes. Only applies if [[Stream.hasAudio]] is `true`.
|
||||
* The frequency this event is fired with is defined by property `interval` of
|
||||
* [[OpenViduAdvancedConfiguration.publisherSpeakingEventsOptions]] (default 100ms)
|
||||
*/
|
||||
streamAudioVolumeChange: StreamManagerEvent;
|
||||
|
||||
/**
|
||||
* Event dispatched when a Stream undergoes any change in any of its mutable properties
|
||||
* (see [[StreamPropertyChangedEvent.changedProperty]]).
|
||||
*/
|
||||
streamPropertyChanged: StreamPropertyChangedEvent;
|
||||
|
||||
/**
|
||||
* Event dispatched when the user owning the stream has started speaking.
|
||||
*
|
||||
* Extra information:
|
||||
* - This event will only be triggered for **streams that have audio tracks** ([[Stream.hasAudio]] must be true).
|
||||
* - Further configuration can be applied on how the event is dispatched by setting property `publisherSpeakingEventsOptions` in the call of [[OpenVidu.setAdvancedConfiguration]].
|
||||
*/
|
||||
publisherStartSpeaking: PublisherSpeakingEvent;
|
||||
|
||||
/**
|
||||
* Event dispatched when the user owning the stream has stopped speaking.
|
||||
*
|
||||
* Extra information:
|
||||
* - This event will only be triggered for **streams that have audio tracks** ([[Stream.hasAudio]] must be true).
|
||||
* - Further configuration can be applied on how the event is dispatched by setting property `publisherSpeakingEventsOptions` in the call of [[OpenVidu.setAdvancedConfiguration]].
|
||||
*/
|
||||
publisherStopSpeaking: PublisherSpeakingEvent;
|
||||
}
|
|
@ -84,10 +84,7 @@ export enum ExceptionEventName {
|
|||
}
|
||||
|
||||
/**
|
||||
* Defines event `exception` dispatched by [[Session]] object.
|
||||
*
|
||||
* This event acts as a global handler for asynchronous errors that may be triggered for multiple reasons and from multiple origins. To see the different
|
||||
* types of exceptions go to [[ExceptionEventName]].
|
||||
* Triggered by [[SessionEventMap.exception]]
|
||||
*/
|
||||
export class ExceptionEvent extends Event {
|
||||
|
||||
|
|
|
@ -20,10 +20,7 @@ import { Session } from '../../OpenVidu/Session';
|
|||
import { Connection } from '../../OpenVidu/Connection';
|
||||
|
||||
/**
|
||||
* **This feature is part of OpenVidu Pro tier** <a href="https://docs.openvidu.io/en/stable/openvidu-pro/" target="_blank" style="display: inline-block; background-color: rgb(0, 136, 170); color: white; font-weight: bold; padding: 0px 5px; margin-right: 5px; border-radius: 3px; font-size: 13px; line-height:21px; font-family: Montserrat, sans-serif">PRO</a>
|
||||
*
|
||||
* Defines event `networkQualityLevelChanged` dispatched by [[Session]].
|
||||
* This event is fired when the network quality level of a [[Connection]] changes. See [network quality](/en/stable/advanced-features/network-quality/)
|
||||
* Triggered by [[networkQualityLevelChanged]]
|
||||
*/
|
||||
export class NetworkQualityLevelChangedEvent extends Event {
|
||||
|
||||
|
|
|
@ -22,13 +22,9 @@ import { StreamManager } from '../../OpenVidu/StreamManager';
|
|||
|
||||
|
||||
/**
|
||||
* Defines the following events:
|
||||
* - `publisherStartSpeaking`: dispatched by [[Session]] and [[StreamManager]] when a user has started speaking
|
||||
* - `publisherStopSpeaking`: dispatched by [[Session]] and [[StreamManager]] when a user has stopped speaking
|
||||
*
|
||||
* More information:
|
||||
* - This events will only be triggered for **streams that have audio tracks** ([[Stream.hasAudio]] must be true)
|
||||
* - You can further configure how the events are dispatched by setting property `publisherSpeakingEventsOptions` in the call of [[OpenVidu.setAdvancedConfiguration]]
|
||||
* Triggered by:
|
||||
* - `publisherStartSpeaking` (available for [Session](/en/stable/api/openvidu-browser/interfaces/SessionEventMap.html#publisherStartSpeaking) and [StreamManager](/en/stable/api/openvidu-browser/interfaces/StreamManagerEventMap.html#publisherStartSpeaking) objects)
|
||||
* - `publisherStopSpeaking` (available for [Session](/en/stable/api/openvidu-browser/interfaces/SessionEventMap.html#publisherStopSpeaking) and [StreamManager](/en/stable/api/openvidu-browser/interfaces/StreamManagerEventMap.html#publisherStopSpeaking) objects)
|
||||
*/
|
||||
export class PublisherSpeakingEvent extends Event {
|
||||
|
||||
|
|
|
@ -20,12 +20,9 @@ import { Session } from '../../OpenVidu/Session';
|
|||
|
||||
|
||||
/**
|
||||
* Defines the following events:
|
||||
* - `recordingStarted`: dispatched by [[Session]] after the session has started being recorded
|
||||
* - `recordingStopped`: dispatched by [[Session]] after the session has stopped being recorded
|
||||
*
|
||||
* Property **`OPENVIDU_RECORDING_NOTIFICATION`** of [OpenVidu Server configuration](/en/stable/reference-docs/openvidu-config/)
|
||||
* defines which users should receive these events (by default, only users with role `PUBLISHER` or `MODERATOR`)
|
||||
* Triggered by:
|
||||
* - [[recordingStarted]]
|
||||
* - [[recordingStopped]]
|
||||
*/
|
||||
export class RecordingEvent extends Event {
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ const logger: OpenViduLogger = OpenViduLogger.getInstance();
|
|||
|
||||
|
||||
/**
|
||||
* Defines event `sessionDisconnected` dispatched by [[Session]] after the local user has left the session. This is the local version of the `connectionDestroyed` event, which is only dispatched by remote users
|
||||
* Triggered by [[sessionDisconnected]]
|
||||
*/
|
||||
export class SessionDisconnectedEvent extends Event {
|
||||
|
||||
|
|
|
@ -21,9 +21,7 @@ import { Session } from '../../OpenVidu/Session';
|
|||
|
||||
|
||||
/**
|
||||
* Defines the following events:
|
||||
* - `signal`: dispatched by [[Session]] when a signal is received
|
||||
* - `signal:TYPE`: dispatched by [[Session]] when a signal of type TYPE is received
|
||||
* Triggered by [[SessionEventMap.signal]]
|
||||
*/
|
||||
export class SignalEvent extends Event {
|
||||
|
||||
|
|
|
@ -27,9 +27,9 @@ import { OpenViduLogger } from '../Logger/OpenViduLogger';
|
|||
const logger: OpenViduLogger = OpenViduLogger.getInstance();
|
||||
|
||||
/**
|
||||
* Defines the following events:
|
||||
* - `streamCreated`: dispatched by [[Session]] and [[Publisher]] after some user has started publishing to the session
|
||||
* - `streamDestroyed`: dispatched by [[Session]] and [[Publisher]] after some user has stopped publishing to the session
|
||||
* Triggered by:
|
||||
* - `streamCreated` (available for [Session](/en/stable/api/openvidu-browser/interfaces/SessionEventMap.html#streamCreated) and [Publisher](/en/stable/api/openvidu-browser/interfaces/PublisherEventMap.html#streamCreated) objects)
|
||||
* - `streamDestroyed]` (available for [Session](/en/stable/api/openvidu-browser/interfaces/SessionEventMap.html#streamDestroyed) and [Publisher](/en/stable/api/openvidu-browser/interfaces/PublisherEventMap.html#streamDestroyed) objects)
|
||||
*/
|
||||
export class StreamEvent extends Event {
|
||||
|
||||
|
|
|
@ -19,15 +19,9 @@ import { Event } from './Event';
|
|||
import { StreamManager } from '../../OpenVidu/StreamManager';
|
||||
|
||||
/**
|
||||
* Defines the following events:
|
||||
* - `streamPlaying`: dispatched by [[StreamManager]] ([[Publisher]] and [[Subscriber]]) whenever its media stream starts playing (one of its videos has media
|
||||
* and has begun to play). This event will be dispatched when these 3 conditions are met:
|
||||
* 1. The StreamManager has no video associated in the DOM
|
||||
* 2. It is associated to one video
|
||||
* 3. That video starts playing. Internally the expected Web API event is [HTMLMediaElement.canplay](https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/canplay_event)
|
||||
* - `streamAudioVolumeChange`: dispatched by [[StreamManager]] ([[Publisher]] and [[Subscriber]]) when the volume of its Stream's audio track
|
||||
* changes. Only applies if [[Stream.hasAudio]] is `true`. The frequency this event is fired with is defined by property `interval` of
|
||||
* [[OpenViduAdvancedConfiguration.publisherSpeakingEventsOptions]] (default 100ms)
|
||||
* Triggered by:
|
||||
* - [[streamPlaying]]
|
||||
* - [[streamAudioVolumeChange]]
|
||||
*/
|
||||
export class StreamManagerEvent extends Event {
|
||||
|
||||
|
|
|
@ -21,9 +21,7 @@ import { Stream } from '../../OpenVidu/Stream';
|
|||
import { StreamManager } from '../../OpenVidu/StreamManager';
|
||||
|
||||
/**
|
||||
* Defines event `streamPropertyChanged` dispatched by [[Session]] as well as by [[StreamManager]] ([[Publisher]] and [[Subscriber]]).
|
||||
* This event is fired when any remote stream (owned by a Subscriber) or local stream (owned by a Publisher) undergoes
|
||||
* any change in any of its mutable properties (see [[changedProperty]]).
|
||||
* Triggered by `streamPropertyChanged` (available for [Session](/en/stable/api/openvidu-browser/interfaces/SessionEventMap.html#streamPropertyChanged) and [StreamManager](/en/stable/api/openvidu-browser/interfaces/StreamManagerEventMap.html#streamPropertyChanged) objects)
|
||||
*/
|
||||
export class StreamPropertyChangedEvent extends Event {
|
||||
|
||||
|
|
|
@ -20,10 +20,9 @@ import { StreamManager } from '../../OpenVidu/StreamManager';
|
|||
|
||||
|
||||
/**
|
||||
* Defines the following events:
|
||||
* - `videoElementCreated`: dispatched by [[Publisher]] and [[Subscriber]] whenever a new HTML video element has been inserted into DOM by OpenVidu Browser library. See
|
||||
* [Manage video players](/en/stable/cheatsheet/manage-videos) section.
|
||||
* - `videoElementDestroyed`: dispatched by [[Publisher]] and [[Subscriber]] whenever an HTML video element has been removed from DOM by OpenVidu Browser library.
|
||||
* Triggered by:
|
||||
* - [[videoElementCreated]]
|
||||
* - [[videoElementDestroyed]]
|
||||
*/
|
||||
export class VideoElementEvent extends Event {
|
||||
|
||||
|
|
|
@ -38,6 +38,7 @@ export { SignalOptions } from './OpenViduInternal/Interfaces/Public/SignalOption
|
|||
export { StreamManagerVideo } from './OpenViduInternal/Interfaces/Public/StreamManagerVideo';
|
||||
export { SubscriberProperties } from './OpenViduInternal/Interfaces/Public/SubscriberProperties';
|
||||
|
||||
export { EventMap } from './OpenViduInternal/Events/EventMap/EventMap';
|
||||
export { SessionEventMap } from './OpenViduInternal/Events/EventMap/SessionEventMap';
|
||||
export { StreamManagerEventMap } from './OpenViduInternal/Events/EventMap/StreamManagerEventMap';
|
||||
export { PublisherEventMap } from './OpenViduInternal/Events/EventMap/PublisherEventMap';
|
||||
|
|
Loading…
Reference in New Issue