mirror of https://github.com/OpenVidu/openvidu.git
openvidu-browser: add Types for Events
parent
a61fb64707
commit
fc93566e04
|
@ -29,6 +29,7 @@ import { OpenViduError, OpenViduErrorName } from '../OpenViduInternal/Enums/Open
|
||||||
import { VideoInsertMode } from '../OpenViduInternal/Enums/VideoInsertMode';
|
import { VideoInsertMode } from '../OpenViduInternal/Enums/VideoInsertMode';
|
||||||
import { OpenViduLogger } from '../OpenViduInternal/Logger/OpenViduLogger';
|
import { OpenViduLogger } from '../OpenViduInternal/Logger/OpenViduLogger';
|
||||||
import { PlatformUtils } from '../OpenViduInternal/Utils/Platform';
|
import { PlatformUtils } from '../OpenViduInternal/Utils/Platform';
|
||||||
|
import { StreamPropertyChangedEventReason, ChangedPropertyType } from '../OpenViduInternal/Events/Types/Types';
|
||||||
|
|
||||||
import * as screenSharingAuto from '../OpenViduInternal/ScreenSharing/Screen-Capturing-Auto';
|
import * as screenSharingAuto from '../OpenViduInternal/ScreenSharing/Screen-Capturing-Auto';
|
||||||
import * as screenSharing from '../OpenViduInternal/ScreenSharing/Screen-Capturing';
|
import * as screenSharing from '../OpenViduInternal/ScreenSharing/Screen-Capturing';
|
||||||
|
@ -219,8 +220,8 @@ export class OpenVidu {
|
||||||
typeof MediaStreamTrack !== 'undefined' && properties.videoSource instanceof MediaStreamTrack
|
typeof MediaStreamTrack !== 'undefined' && properties.videoSource instanceof MediaStreamTrack
|
||||||
? undefined
|
? undefined
|
||||||
: typeof properties.frameRate !== 'undefined'
|
: typeof properties.frameRate !== 'undefined'
|
||||||
? properties.frameRate
|
? properties.frameRate
|
||||||
: undefined,
|
: undefined,
|
||||||
insertMode:
|
insertMode:
|
||||||
typeof properties.insertMode !== 'undefined'
|
typeof properties.insertMode !== 'undefined'
|
||||||
? typeof properties.insertMode === 'string'
|
? typeof properties.insertMode === 'string'
|
||||||
|
@ -234,8 +235,8 @@ export class OpenVidu {
|
||||||
typeof MediaStreamTrack !== 'undefined' && properties.videoSource instanceof MediaStreamTrack
|
typeof MediaStreamTrack !== 'undefined' && properties.videoSource instanceof MediaStreamTrack
|
||||||
? undefined
|
? undefined
|
||||||
: typeof properties.resolution !== 'undefined'
|
: typeof properties.resolution !== 'undefined'
|
||||||
? properties.resolution
|
? properties.resolution
|
||||||
: '640x480',
|
: '640x480',
|
||||||
videoSource: typeof properties.videoSource !== 'undefined' ? properties.videoSource : undefined,
|
videoSource: typeof properties.videoSource !== 'undefined' ? properties.videoSource : undefined,
|
||||||
videoSimulcast: properties.videoSimulcast,
|
videoSimulcast: properties.videoSimulcast,
|
||||||
filter: properties.filter
|
filter: properties.filter
|
||||||
|
@ -642,7 +643,7 @@ export class OpenVidu {
|
||||||
/**
|
/**
|
||||||
* @hidden
|
* @hidden
|
||||||
*/
|
*/
|
||||||
sendNewVideoDimensionsIfRequired(publisher: Publisher, reason: string, WAIT_INTERVAL: number, MAX_ATTEMPTS: number) {
|
sendNewVideoDimensionsIfRequired(publisher: Publisher, reason: StreamPropertyChangedEventReason, WAIT_INTERVAL: number, MAX_ATTEMPTS: number) {
|
||||||
let attempts = 0;
|
let attempts = 0;
|
||||||
const oldWidth = publisher?.stream?.videoDimensions?.width || 0;
|
const oldWidth = publisher?.stream?.videoDimensions?.width || 0;
|
||||||
const oldHeight = publisher?.stream?.videoDimensions?.height || 0;
|
const oldHeight = publisher?.stream?.videoDimensions?.height || 0;
|
||||||
|
@ -666,7 +667,7 @@ export class OpenVidu {
|
||||||
*/
|
*/
|
||||||
sendVideoDimensionsChangedEvent(
|
sendVideoDimensionsChangedEvent(
|
||||||
publisher: Publisher,
|
publisher: Publisher,
|
||||||
reason: string,
|
reason: StreamPropertyChangedEventReason,
|
||||||
oldWidth: number,
|
oldWidth: number,
|
||||||
oldHeight: number,
|
oldHeight: number,
|
||||||
newWidth: number,
|
newWidth: number,
|
||||||
|
@ -717,7 +718,7 @@ export class OpenVidu {
|
||||||
/**
|
/**
|
||||||
* @hidden
|
* @hidden
|
||||||
*/
|
*/
|
||||||
sendTrackChangedEvent(publisher: Publisher, oldLabel: string, newLabel: string, propertyType: string) {
|
sendTrackChangedEvent(publisher: Publisher, oldLabel: string, newLabel: string, propertyType: ChangedPropertyType) {
|
||||||
const oldValue = { label: oldLabel };
|
const oldValue = { label: oldLabel };
|
||||||
const newValue = { label: newLabel };
|
const newValue = { label: newLabel };
|
||||||
const reason = 'trackReplaced';
|
const reason = 'trackReplaced';
|
||||||
|
@ -1028,9 +1029,9 @@ export class OpenVidu {
|
||||||
const error = new OpenViduError(
|
const error = new OpenViduError(
|
||||||
OpenViduErrorName.SCREEN_SHARING_NOT_SUPPORTED,
|
OpenViduErrorName.SCREEN_SHARING_NOT_SUPPORTED,
|
||||||
'You can only screen share in desktop Chrome, Firefox, Opera, Safari (>=13.0), Edge (>= 80) or Electron. Detected client: ' +
|
'You can only screen share in desktop Chrome, Firefox, Opera, Safari (>=13.0), Edge (>= 80) or Electron. Detected client: ' +
|
||||||
platform.getName() +
|
platform.getName() +
|
||||||
' ' +
|
' ' +
|
||||||
platform.getVersion()
|
platform.getVersion()
|
||||||
);
|
);
|
||||||
logger.error(error);
|
logger.error(error);
|
||||||
return reject(error);
|
return reject(error);
|
||||||
|
|
|
@ -28,6 +28,7 @@ import { VideoInsertMode } from '../OpenViduInternal/Enums/VideoInsertMode';
|
||||||
import { OpenViduLogger } from '../OpenViduInternal/Logger/OpenViduLogger';
|
import { OpenViduLogger } from '../OpenViduInternal/Logger/OpenViduLogger';
|
||||||
import { PlatformUtils } from '../OpenViduInternal/Utils/Platform';
|
import { PlatformUtils } from '../OpenViduInternal/Utils/Platform';
|
||||||
import { TypeOfVideo } from '../OpenViduInternal/Enums/TypeOfVideo';
|
import { TypeOfVideo } from '../OpenViduInternal/Enums/TypeOfVideo';
|
||||||
|
import { StreamEventReason } from '../OpenViduInternal/Events/Types/Types';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @hidden
|
* @hidden
|
||||||
|
@ -92,7 +93,7 @@ export class Publisher extends StreamManager {
|
||||||
this.properties = properties;
|
this.properties = properties;
|
||||||
this.openvidu = openvidu;
|
this.openvidu = openvidu;
|
||||||
|
|
||||||
this.stream.ee.on('local-stream-destroyed', (reason: string) => {
|
this.stream.ee.on('local-stream-destroyed', (reason: StreamEventReason) => {
|
||||||
this.stream.isLocalStreamPublished = false;
|
this.stream.isLocalStreamPublished = false;
|
||||||
const streamEvent = new StreamEvent(true, this, 'streamDestroyed', this.stream, reason);
|
const streamEvent = new StreamEvent(true, this, 'streamDestroyed', this.stream, reason);
|
||||||
this.emitEvent('streamDestroyed', [streamEvent]);
|
this.emitEvent('streamDestroyed', [streamEvent]);
|
||||||
|
|
|
@ -44,6 +44,7 @@ import { OpenViduError, OpenViduErrorName } from '../OpenViduInternal/Enums/Open
|
||||||
import { VideoInsertMode } from '../OpenViduInternal/Enums/VideoInsertMode';
|
import { VideoInsertMode } from '../OpenViduInternal/Enums/VideoInsertMode';
|
||||||
import { OpenViduLogger } from '../OpenViduInternal/Logger/OpenViduLogger';
|
import { OpenViduLogger } from '../OpenViduInternal/Logger/OpenViduLogger';
|
||||||
import { PlatformUtils } from '../OpenViduInternal/Utils/Platform';
|
import { PlatformUtils } from '../OpenViduInternal/Utils/Platform';
|
||||||
|
import { StreamPropertyChangedEventReason, ChangedPropertyType, RecordingEventReason, ConnectionEventReason, StreamEventReason } from '../OpenViduInternal/Events/Types/Types';
|
||||||
/**
|
/**
|
||||||
* @hidden
|
* @hidden
|
||||||
*/
|
*/
|
||||||
|
@ -833,7 +834,7 @@ export class Session extends EventDispatcher {
|
||||||
/**
|
/**
|
||||||
* @hidden
|
* @hidden
|
||||||
*/
|
*/
|
||||||
onParticipantLeft(event: { connectionId: string; reason: string }): void {
|
onParticipantLeft(event: { connectionId: string; reason: ConnectionEventReason }): void {
|
||||||
this.getRemoteConnection(event.connectionId, 'onParticipantLeft')
|
this.getRemoteConnection(event.connectionId, 'onParticipantLeft')
|
||||||
.then((connection) => {
|
.then((connection) => {
|
||||||
if (!!connection.stream) {
|
if (!!connection.stream) {
|
||||||
|
@ -897,7 +898,7 @@ export class Session extends EventDispatcher {
|
||||||
/**
|
/**
|
||||||
* @hidden
|
* @hidden
|
||||||
*/
|
*/
|
||||||
onParticipantUnpublished(event: { connectionId: string; reason: string }): void {
|
onParticipantUnpublished(event: { connectionId: string; reason: StreamEventReason }): void {
|
||||||
if (event.connectionId === this.connection.connectionId) {
|
if (event.connectionId === this.connection.connectionId) {
|
||||||
// Your stream has been forcedly unpublished from the session
|
// Your stream has been forcedly unpublished from the session
|
||||||
this.stopPublisherStream(event.reason);
|
this.stopPublisherStream(event.reason);
|
||||||
|
@ -925,7 +926,7 @@ export class Session extends EventDispatcher {
|
||||||
/**
|
/**
|
||||||
* @hidden
|
* @hidden
|
||||||
*/
|
*/
|
||||||
onParticipantEvicted(event: { connectionId: string; reason: string }): void {
|
onParticipantEvicted(event: { connectionId: string; reason: ConnectionEventReason }): void {
|
||||||
if (event.connectionId === this.connection.connectionId) {
|
if (event.connectionId === this.connection.connectionId) {
|
||||||
// You have been evicted from the session
|
// You have been evicted from the session
|
||||||
if (!!this.sessionId && !this.connection.disposed) {
|
if (!!this.sessionId && !this.connection.disposed) {
|
||||||
|
@ -975,7 +976,7 @@ export class Session extends EventDispatcher {
|
||||||
/**
|
/**
|
||||||
* @hidden
|
* @hidden
|
||||||
*/
|
*/
|
||||||
onStreamPropertyChanged(event: { connectionId: string; streamId: string; property: string; newValue: any; reason: string }): void {
|
onStreamPropertyChanged(event: { connectionId: string; streamId: string; property: ChangedPropertyType; newValue: any; reason: StreamPropertyChangedEventReason }): void {
|
||||||
const callback = (connection: Connection) => {
|
const callback = (connection: Connection) => {
|
||||||
if (!!connection.stream && connection.stream.streamId === event.streamId) {
|
if (!!connection.stream && connection.stream.streamId === event.streamId) {
|
||||||
const stream = connection.stream;
|
const stream = connection.stream;
|
||||||
|
@ -1159,7 +1160,7 @@ export class Session extends EventDispatcher {
|
||||||
/**
|
/**
|
||||||
* @hidden
|
* @hidden
|
||||||
*/
|
*/
|
||||||
onLostConnection(reason: string): void {
|
onLostConnection(reason: ConnectionEventReason): void {
|
||||||
logger.warn('Lost connection in Session ' + this.sessionId);
|
logger.warn('Lost connection in Session ' + this.sessionId);
|
||||||
if (!!this.sessionId && !!this.connection && !this.connection.disposed) {
|
if (!!this.sessionId && !!this.connection && !this.connection.disposed) {
|
||||||
this.leave(true, reason);
|
this.leave(true, reason);
|
||||||
|
@ -1202,7 +1203,7 @@ export class Session extends EventDispatcher {
|
||||||
/**
|
/**
|
||||||
* @hidden
|
* @hidden
|
||||||
*/
|
*/
|
||||||
onRecordingStopped(event: { id: string; name: string; reason: string }): void {
|
onRecordingStopped(event: { id: string; name: string; reason: RecordingEventReason }): void {
|
||||||
this.ee.emitEvent('recordingStopped', [new RecordingEvent(this, 'recordingStopped', event.id, event.name, event.reason)]);
|
this.ee.emitEvent('recordingStopped', [new RecordingEvent(this, 'recordingStopped', event.id, event.name, event.reason)]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1354,7 +1355,7 @@ export class Session extends EventDispatcher {
|
||||||
/**
|
/**
|
||||||
* @hidden
|
* @hidden
|
||||||
*/
|
*/
|
||||||
leave(forced: boolean, reason: string): void {
|
leave(forced: boolean, reason: ConnectionEventReason): void {
|
||||||
forced = !!forced;
|
forced = !!forced;
|
||||||
logger.info('Leaving Session (forced=' + forced + ')');
|
logger.info('Leaving Session (forced=' + forced + ')');
|
||||||
this.stopVideoDataIntervals();
|
this.stopVideoDataIntervals();
|
||||||
|
@ -1636,7 +1637,7 @@ export class Session extends EventDispatcher {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private stopPublisherStream(reason: string) {
|
private stopPublisherStream(reason: StreamEventReason) {
|
||||||
if (!!this.connection.stream) {
|
if (!!this.connection.stream) {
|
||||||
// Dispose Publisher's local stream
|
// Dispose Publisher's local stream
|
||||||
this.connection.stream.disposeWebRtcPeer();
|
this.connection.stream.disposeWebRtcPeer();
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
import { Event } from './Event';
|
import { Event } from './Event';
|
||||||
import { Connection } from '../../OpenVidu/Connection';
|
import { Connection } from '../../OpenVidu/Connection';
|
||||||
import { Session } from '../../OpenVidu/Session';
|
import { Session } from '../../OpenVidu/Session';
|
||||||
|
import { ConnectionEventReason } from './Types/Types';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Triggered by:
|
* Triggered by:
|
||||||
|
@ -41,12 +42,12 @@ export class ConnectionEvent extends Event {
|
||||||
*
|
*
|
||||||
* For `connectionCreated` event an empty string
|
* For `connectionCreated` event an empty string
|
||||||
*/
|
*/
|
||||||
reason: string;
|
reason: ConnectionEventReason;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @hidden
|
* @hidden
|
||||||
*/
|
*/
|
||||||
constructor(cancelable: boolean, target: Session, type: string, connection: Connection, reason: string) {
|
constructor(cancelable: boolean, target: Session, type: string, connection: Connection, reason: ConnectionEventReason) {
|
||||||
super(cancelable, target, type);
|
super(cancelable, target, type);
|
||||||
this.connection = connection;
|
this.connection = connection;
|
||||||
this.reason = reason;
|
this.reason = reason;
|
||||||
|
@ -56,5 +57,5 @@ export class ConnectionEvent extends Event {
|
||||||
* @hidden
|
* @hidden
|
||||||
*/
|
*/
|
||||||
// tslint:disable-next-line:no-empty
|
// tslint:disable-next-line:no-empty
|
||||||
callDefaultBehavior() {}
|
callDefaultBehavior() { }
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
|
|
||||||
import { Event } from './Event';
|
import { Event } from './Event';
|
||||||
import { Session } from '../../OpenVidu/Session';
|
import { Session } from '../../OpenVidu/Session';
|
||||||
|
import { RecordingEventReason } from './Types/Types';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Triggered by:
|
* Triggered by:
|
||||||
|
@ -48,12 +49,12 @@ export class RecordingEvent extends Event {
|
||||||
*
|
*
|
||||||
* For 'recordingStarted' empty string
|
* For 'recordingStarted' empty string
|
||||||
*/
|
*/
|
||||||
reason?: string;
|
reason?: RecordingEventReason;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @hidden
|
* @hidden
|
||||||
*/
|
*/
|
||||||
constructor(target: Session, type: string, id: string, name: string, reason?: string) {
|
constructor(target: Session, type: string, id: string, name: string, reason?: RecordingEventReason) {
|
||||||
super(false, target, type);
|
super(false, target, type);
|
||||||
this.id = id;
|
this.id = id;
|
||||||
if (name !== id) {
|
if (name !== id) {
|
||||||
|
@ -66,5 +67,5 @@ export class RecordingEvent extends Event {
|
||||||
* @hidden
|
* @hidden
|
||||||
*/
|
*/
|
||||||
// tslint:disable-next-line:no-empty
|
// tslint:disable-next-line:no-empty
|
||||||
callDefaultBehavior() {}
|
callDefaultBehavior() { }
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
import { Event } from './Event';
|
import { Event } from './Event';
|
||||||
import { Session } from '../../OpenVidu/Session';
|
import { Session } from '../../OpenVidu/Session';
|
||||||
import { OpenViduLogger } from '../Logger/OpenViduLogger';
|
import { OpenViduLogger } from '../Logger/OpenViduLogger';
|
||||||
|
import { ConnectionEventReason } from './Types/Types';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @hidden
|
* @hidden
|
||||||
|
@ -40,12 +41,12 @@ export class SessionDisconnectedEvent extends Event {
|
||||||
* - "nodeCrashed": a node has crashed in the server side. You can use this reason to ask your application's backend to reconnect
|
* - "nodeCrashed": a node has crashed in the server side. You can use this reason to ask your application's backend to reconnect
|
||||||
* to a new session to replace the crashed one
|
* to a new session to replace the crashed one
|
||||||
*/
|
*/
|
||||||
reason: string;
|
reason: ConnectionEventReason;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @hidden
|
* @hidden
|
||||||
*/
|
*/
|
||||||
constructor(target: Session, reason: string) {
|
constructor(target: Session, reason: ConnectionEventReason) {
|
||||||
super(true, target, 'sessionDisconnected');
|
super(true, target, 'sessionDisconnected');
|
||||||
this.reason = reason;
|
this.reason = reason;
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
import { Event } from './Event';
|
import { Event } from './Event';
|
||||||
import { Connection } from '../../OpenVidu/Connection';
|
import { Connection } from '../../OpenVidu/Connection';
|
||||||
import { Session } from '../../OpenVidu/Session';
|
import { Session } from '../../OpenVidu/Session';
|
||||||
|
import { SpeechToTextEventReason } from './Types/Types';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Triggered by [[SessionEventMap.speechToTextMessage]]
|
* Triggered by [[SessionEventMap.speechToTextMessage]]
|
||||||
|
@ -38,7 +39,7 @@ export class SpeechToTextEvent extends Event {
|
||||||
/**
|
/**
|
||||||
* All speech-to-text events are generated
|
* All speech-to-text events are generated
|
||||||
*/
|
*/
|
||||||
reason: 'recognizing' | 'recognized';
|
reason: SpeechToTextEventReason;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The original event from the speech to text engine. This can vary depending on the engine
|
* The original event from the speech to text engine. This can vary depending on the engine
|
||||||
|
@ -54,7 +55,7 @@ export class SpeechToTextEvent extends Event {
|
||||||
/**
|
/**
|
||||||
* @hidden
|
* @hidden
|
||||||
*/
|
*/
|
||||||
constructor(target: Session, connection: Connection, text: string, reason: 'recognizing' | 'recognized', raw: string, lang: string) {
|
constructor(target: Session, connection: Connection, text: string, reason: SpeechToTextEventReason, raw: string, lang: string) {
|
||||||
super(false, target, 'speechToTextMessage');
|
super(false, target, 'speechToTextMessage');
|
||||||
this.connection = connection;
|
this.connection = connection;
|
||||||
this.text = text;
|
this.text = text;
|
||||||
|
|
|
@ -20,6 +20,7 @@ import { Publisher } from '../../OpenVidu/Publisher';
|
||||||
import { Session } from '../../OpenVidu/Session';
|
import { Session } from '../../OpenVidu/Session';
|
||||||
import { Stream } from '../../OpenVidu/Stream';
|
import { Stream } from '../../OpenVidu/Stream';
|
||||||
import { OpenViduLogger } from '../Logger/OpenViduLogger';
|
import { OpenViduLogger } from '../Logger/OpenViduLogger';
|
||||||
|
import { StreamEventReason } from './Types/Types';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @hidden
|
* @hidden
|
||||||
|
@ -51,12 +52,12 @@ export class StreamEvent extends Event {
|
||||||
*
|
*
|
||||||
* For 'streamCreated' empty string
|
* For 'streamCreated' empty string
|
||||||
*/
|
*/
|
||||||
reason: string;
|
reason: StreamEventReason;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @hidden
|
* @hidden
|
||||||
*/
|
*/
|
||||||
constructor(cancelable: boolean, target: Session | Publisher, type: string, stream: Stream, reason: string) {
|
constructor(cancelable: boolean, target: Session | Publisher, type: string, stream: Stream, reason: StreamEventReason) {
|
||||||
super(cancelable, target, type);
|
super(cancelable, target, type);
|
||||||
this.stream = stream;
|
this.stream = stream;
|
||||||
this.reason = reason;
|
this.reason = reason;
|
||||||
|
|
|
@ -19,6 +19,7 @@ import { Event } from './Event';
|
||||||
import { Session } from '../../OpenVidu/Session';
|
import { Session } from '../../OpenVidu/Session';
|
||||||
import { Stream } from '../../OpenVidu/Stream';
|
import { Stream } from '../../OpenVidu/Stream';
|
||||||
import { StreamManager } from '../../OpenVidu/StreamManager';
|
import { StreamManager } from '../../OpenVidu/StreamManager';
|
||||||
|
import { StreamPropertyChangedEventReason, ChangedPropertyType } from './Types/Types';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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)
|
* 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)
|
||||||
|
@ -32,7 +33,7 @@ export class StreamPropertyChangedEvent extends Event {
|
||||||
/**
|
/**
|
||||||
* The property of the stream that changed. This value is either `"videoActive"`, `"audioActive"`, `"videoTrack"`, `"audioTrack"`, `"videoDimensions"` or `"filter"`
|
* The property of the stream that changed. This value is either `"videoActive"`, `"audioActive"`, `"videoTrack"`, `"audioTrack"`, `"videoDimensions"` or `"filter"`
|
||||||
*/
|
*/
|
||||||
changedProperty: string;
|
changedProperty: ChangedPropertyType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cause of the change on the stream's property:
|
* Cause of the change on the stream's property:
|
||||||
|
@ -43,7 +44,7 @@ export class StreamPropertyChangedEvent extends Event {
|
||||||
* - For `videoDimensions`: `"deviceRotated"`, `"screenResized"` or `"trackReplaced"`
|
* - For `videoDimensions`: `"deviceRotated"`, `"screenResized"` or `"trackReplaced"`
|
||||||
* - For `filter`: `"applyFilter"`, `"execFilterMethod"` or `"removeFilter"`
|
* - For `filter`: `"applyFilter"`, `"execFilterMethod"` or `"removeFilter"`
|
||||||
*/
|
*/
|
||||||
reason: string;
|
reason: StreamPropertyChangedEventReason;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* New value of the property (after change, current value)
|
* New value of the property (after change, current value)
|
||||||
|
@ -61,10 +62,10 @@ export class StreamPropertyChangedEvent extends Event {
|
||||||
constructor(
|
constructor(
|
||||||
target: Session | StreamManager,
|
target: Session | StreamManager,
|
||||||
stream: Stream,
|
stream: Stream,
|
||||||
changedProperty: string,
|
changedProperty: ChangedPropertyType,
|
||||||
newValue: Object,
|
newValue: Object,
|
||||||
oldValue: Object,
|
oldValue: Object,
|
||||||
reason: string
|
reason: StreamPropertyChangedEventReason
|
||||||
) {
|
) {
|
||||||
super(false, target, 'streamPropertyChanged');
|
super(false, target, 'streamPropertyChanged');
|
||||||
this.stream = stream;
|
this.stream = stream;
|
||||||
|
@ -78,5 +79,5 @@ export class StreamPropertyChangedEvent extends Event {
|
||||||
* @hidden
|
* @hidden
|
||||||
*/
|
*/
|
||||||
// tslint:disable-next-line:no-empty
|
// tslint:disable-next-line:no-empty
|
||||||
callDefaultBehavior() {}
|
callDefaultBehavior() { }
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,42 @@
|
||||||
|
export type ChangedPropertyType =
|
||||||
|
'videoActive' |
|
||||||
|
'audioActive' |
|
||||||
|
'videoTrack' |
|
||||||
|
'audioTrack' |
|
||||||
|
'videoDimensions' |
|
||||||
|
'filter';
|
||||||
|
|
||||||
|
export type StreamPropertyChangedEventReason =
|
||||||
|
'publishVideo' |
|
||||||
|
'publishAudio' |
|
||||||
|
'trackReplaced' |
|
||||||
|
'deviceRotated' |
|
||||||
|
'screenResized' |
|
||||||
|
'applyFilter' |
|
||||||
|
'execFilterMethod' |
|
||||||
|
'removeFilter';
|
||||||
|
|
||||||
|
export type ConnectionEventReason =
|
||||||
|
'disconnect' |
|
||||||
|
'forceDisconnectByUser' |
|
||||||
|
'forceDisconnectByServer' |
|
||||||
|
'sessionClosedByServer' |
|
||||||
|
'networkDisconnect' |
|
||||||
|
'nodeCrashed' |
|
||||||
|
'';
|
||||||
|
|
||||||
|
export type StreamEventReason =
|
||||||
|
ConnectionEventReason |
|
||||||
|
'unpublish' |
|
||||||
|
'forceUnpublishByUser' |
|
||||||
|
'forceUnpublishByServer';
|
||||||
|
|
||||||
|
export type RecordingEventReason =
|
||||||
|
'recordingStoppedByServer' |
|
||||||
|
'sessionClosedByServer' |
|
||||||
|
'automaticStop' |
|
||||||
|
'nodeCrashed';
|
||||||
|
|
||||||
|
export type SpeechToTextEventReason =
|
||||||
|
'recognizing' |
|
||||||
|
'recognized';
|
|
@ -45,5 +45,7 @@ export { SessionEventMap } from './OpenViduInternal/Events/EventMap/SessionEvent
|
||||||
export { StreamManagerEventMap } from './OpenViduInternal/Events/EventMap/StreamManagerEventMap';
|
export { StreamManagerEventMap } from './OpenViduInternal/Events/EventMap/StreamManagerEventMap';
|
||||||
export { PublisherEventMap } from './OpenViduInternal/Events/EventMap/PublisherEventMap';
|
export { PublisherEventMap } from './OpenViduInternal/Events/EventMap/PublisherEventMap';
|
||||||
|
|
||||||
|
export * from './OpenViduInternal/Events/Types/Types';
|
||||||
|
|
||||||
// Disable jsnlog when library is loaded
|
// Disable jsnlog when library is loaded
|
||||||
JL.setOptions({ enabled: false });
|
JL.setOptions({ enabled: false });
|
||||||
|
|
Loading…
Reference in New Issue