2018-05-08 13:01:34 +02:00
|
|
|
import { Connection } from './Connection';
|
2018-10-01 11:17:05 +02:00
|
|
|
import { Event } from '../OpenViduInternal/Events/Event';
|
|
|
|
import { Filter } from './Filter';
|
2018-05-08 13:01:34 +02:00
|
|
|
import { Session } from './Session';
|
2018-06-01 14:39:38 +02:00
|
|
|
import { StreamManager } from './StreamManager';
|
2018-10-01 11:17:05 +02:00
|
|
|
import { EventDispatcher } from '../OpenViduInternal/Interfaces/Public/EventDispatcher';
|
2018-04-26 15:33:47 +02:00
|
|
|
import { InboundStreamOptions } from '../OpenViduInternal/Interfaces/Private/InboundStreamOptions';
|
|
|
|
import { OutboundStreamOptions } from '../OpenViduInternal/Interfaces/Private/OutboundStreamOptions';
|
2018-06-27 16:29:31 +02:00
|
|
|
import { WebRtcPeer } from '../OpenViduInternal/WebRtcPeer/WebRtcPeer';
|
2018-06-01 14:39:38 +02:00
|
|
|
import EventEmitter = require('wolfy87-eventemitter');
|
2018-04-26 15:33:47 +02:00
|
|
|
/**
|
2018-06-01 14:39:38 +02:00
|
|
|
* Represents each one of the media streams available in OpenVidu Server for certain session.
|
|
|
|
* Each [[Publisher]] and [[Subscriber]] has an attribute of type Stream, as they give access
|
|
|
|
* to one of them (sending and receiving it, respectively)
|
2018-04-26 15:33:47 +02:00
|
|
|
*/
|
2018-10-01 11:17:05 +02:00
|
|
|
export declare class Stream implements EventDispatcher {
|
2018-04-26 15:33:47 +02:00
|
|
|
/**
|
|
|
|
* The Connection object that is publishing the stream
|
|
|
|
*/
|
|
|
|
connection: Connection;
|
|
|
|
/**
|
2018-06-01 14:39:38 +02:00
|
|
|
* Frame rate of the video in frames per second. This property is only defined if the [[Publisher]] of
|
|
|
|
* the stream was initialized passing a _frameRate_ property on [[OpenVidu.initPublisher]] method
|
2018-04-26 15:33:47 +02:00
|
|
|
*/
|
|
|
|
frameRate?: number;
|
|
|
|
/**
|
|
|
|
* Whether the stream has a video track or not
|
|
|
|
*/
|
|
|
|
hasVideo: boolean;
|
|
|
|
/**
|
|
|
|
* Whether the stream has an audio track or not
|
|
|
|
*/
|
|
|
|
hasAudio: boolean;
|
2018-07-11 11:47:53 +02:00
|
|
|
/**
|
|
|
|
* Whether the stream has the video track muted or unmuted. If [[hasVideo]] is false, this property is undefined.
|
|
|
|
*
|
|
|
|
* This property may change if the Publisher publishing the stream calls [[Publisher.publishVideo]]. Whenever this happens a [[StreamPropertyChangedEvent]] will be dispatched
|
|
|
|
* by the Session object as well as by the affected Subscriber/Publisher object
|
|
|
|
*/
|
|
|
|
videoActive: boolean;
|
|
|
|
/**
|
|
|
|
* Whether the stream has the audio track muted or unmuted. If [[hasAudio]] is false, this property is undefined
|
|
|
|
*
|
|
|
|
* This property may change if the Publisher publishing the stream calls [[Publisher.publishAudio]]. Whenever this happens a [[StreamPropertyChangedEvent]] will be dispatched
|
|
|
|
* by the Session object as well as by the affected Subscriber/Publisher object
|
|
|
|
*/
|
|
|
|
audioActive: boolean;
|
2018-04-26 15:33:47 +02:00
|
|
|
/**
|
2018-11-26 10:30:49 +01:00
|
|
|
* Unique identifier of the stream. If the stream belongs to a...
|
|
|
|
* - Subscriber object: property `streamId` is always defined
|
|
|
|
* - Publisher object: property `streamId` is only defined after successful execution of [[Session.publish]]
|
2018-04-26 15:33:47 +02:00
|
|
|
*/
|
|
|
|
streamId: string;
|
|
|
|
/**
|
2018-07-11 11:47:53 +02:00
|
|
|
* `"CAMERA"`, `"SCREEN"` or `"CUSTOM"` (the latter when [[PublisherProperties.videoSource]] is a MediaStreamTrack when calling [[OpenVidu.initPublisher]]).
|
|
|
|
* If [[hasVideo]] is false, this property is undefined
|
2018-04-26 15:33:47 +02:00
|
|
|
*/
|
|
|
|
typeOfVideo?: string;
|
|
|
|
/**
|
2018-06-01 14:39:38 +02:00
|
|
|
* StreamManager object ([[Publisher]] or [[Subscriber]]) in charge of displaying this stream in the DOM
|
2018-04-26 15:33:47 +02:00
|
|
|
*/
|
2018-06-01 14:39:38 +02:00
|
|
|
streamManager: StreamManager;
|
2018-07-11 11:47:53 +02:00
|
|
|
/**
|
|
|
|
* Width and height in pixels of the encoded video stream. If [[hasVideo]] is false, this property is undefined
|
|
|
|
*
|
|
|
|
* This property may change if the Publisher that is publishing:
|
|
|
|
* - If it is a mobile device, whenever the user rotates the device.
|
|
|
|
* - If it is screen-sharing, whenever the user changes the size of the captured window.
|
|
|
|
*
|
|
|
|
* Whenever this happens a [[StreamPropertyChangedEvent]] will be dispatched by the Session object as well as by the affected Subscriber/Publisher object
|
|
|
|
*/
|
|
|
|
videoDimensions: {
|
|
|
|
width: number;
|
|
|
|
height: number;
|
|
|
|
};
|
2018-10-01 11:17:05 +02:00
|
|
|
/**
|
|
|
|
* **WARNING**: experimental option. This interface may change in the near future
|
|
|
|
*
|
|
|
|
* Filter applied to the Stream. You can apply filters by calling [[Stream.applyFilter]], execute methods of the applied filter with
|
|
|
|
* [[Filter.execMethod]] and remove it with [[Stream.removeFilter]]. Be aware that the client calling this methods must have the
|
|
|
|
* necessary permissions: the token owned by the client must have been initialized with the appropriated `allowedFilters` array.
|
|
|
|
*/
|
|
|
|
filter: Filter;
|
2018-04-26 15:33:47 +02:00
|
|
|
/**
|
|
|
|
* @hidden
|
|
|
|
*/
|
2018-06-01 14:39:38 +02:00
|
|
|
ee: EventEmitter;
|
|
|
|
private webRtcPeer;
|
|
|
|
private mediaStream;
|
|
|
|
private webRtcStats;
|
|
|
|
private isSubscribeToRemote;
|
2018-04-26 15:33:47 +02:00
|
|
|
/**
|
|
|
|
* @hidden
|
|
|
|
*/
|
2018-06-01 14:39:38 +02:00
|
|
|
isLocalStreamReadyToPublish: boolean;
|
2018-04-26 15:33:47 +02:00
|
|
|
/**
|
|
|
|
* @hidden
|
|
|
|
*/
|
2018-06-01 14:39:38 +02:00
|
|
|
isLocalStreamPublished: boolean;
|
2018-07-11 11:47:53 +02:00
|
|
|
/**
|
|
|
|
* @hidden
|
|
|
|
*/
|
|
|
|
publishedOnce: boolean;
|
2018-04-26 15:33:47 +02:00
|
|
|
/**
|
|
|
|
* @hidden
|
|
|
|
*/
|
|
|
|
session: Session;
|
|
|
|
/**
|
|
|
|
* @hidden
|
|
|
|
*/
|
|
|
|
inboundStreamOpts: InboundStreamOptions;
|
|
|
|
/**
|
|
|
|
* @hidden
|
|
|
|
*/
|
|
|
|
outboundStreamOpts: OutboundStreamOptions;
|
|
|
|
/**
|
|
|
|
* @hidden
|
|
|
|
*/
|
|
|
|
speechEvent: any;
|
2018-12-14 14:01:16 +01:00
|
|
|
/**
|
|
|
|
* @hidden
|
|
|
|
*/
|
|
|
|
publisherStartSpeakingEventEnabled: boolean;
|
|
|
|
/**
|
|
|
|
* @hidden
|
|
|
|
*/
|
|
|
|
publisherStopSpeakingEventEnabled: boolean;
|
|
|
|
/**
|
|
|
|
* @hidden
|
|
|
|
*/
|
|
|
|
volumeChangeEventEnabled: boolean;
|
2018-04-26 15:33:47 +02:00
|
|
|
/**
|
|
|
|
* @hidden
|
|
|
|
*/
|
|
|
|
constructor(session: Session, options: InboundStreamOptions | OutboundStreamOptions | {});
|
2018-10-01 11:17:05 +02:00
|
|
|
/**
|
|
|
|
* See [[EventDispatcher.on]]
|
|
|
|
*/
|
|
|
|
on(type: string, handler: (event: Event) => void): EventDispatcher;
|
|
|
|
/**
|
|
|
|
* See [[EventDispatcher.once]]
|
|
|
|
*/
|
|
|
|
once(type: string, handler: (event: Event) => void): EventDispatcher;
|
|
|
|
/**
|
|
|
|
* See [[EventDispatcher.off]]
|
|
|
|
*/
|
|
|
|
off(type: string, handler?: (event: Event) => void): EventDispatcher;
|
|
|
|
/**
|
|
|
|
* Applies an audio/video filter to the stream.
|
|
|
|
*
|
|
|
|
* @param type Type of filter applied. See [[Filter.type]]
|
|
|
|
* @param options Parameters used to initialize the filter. See [[Filter.options]]
|
|
|
|
*
|
|
|
|
* @returns A Promise (to which you can optionally subscribe to) that is resolved to the applied filter if success and rejected with an Error object if not
|
|
|
|
*/
|
|
|
|
applyFilter(type: string, options: Object): Promise<Filter>;
|
|
|
|
/**
|
|
|
|
* Removes an audio/video filter previously applied.
|
|
|
|
*
|
|
|
|
* @returns A Promise (to which you can optionally subscribe to) that is resolved if the previously applied filter has been successfully removed and rejected with an Error object in other case
|
|
|
|
*/
|
|
|
|
removeFilter(): Promise<any>;
|
2018-04-26 15:33:47 +02:00
|
|
|
/**
|
|
|
|
* @hidden
|
|
|
|
*/
|
|
|
|
getMediaStream(): MediaStream;
|
|
|
|
/**
|
|
|
|
* @hidden
|
|
|
|
*/
|
|
|
|
setMediaStream(mediaStream: MediaStream): void;
|
|
|
|
/**
|
|
|
|
* @hidden
|
|
|
|
*/
|
2018-06-01 14:39:38 +02:00
|
|
|
updateMediaStreamInVideos(): void;
|
2018-04-26 15:33:47 +02:00
|
|
|
/**
|
|
|
|
* @hidden
|
|
|
|
*/
|
2018-06-27 16:29:31 +02:00
|
|
|
getWebRtcPeer(): WebRtcPeer;
|
2018-04-26 15:33:47 +02:00
|
|
|
/**
|
|
|
|
* @hidden
|
|
|
|
*/
|
2018-06-01 14:39:38 +02:00
|
|
|
getRTCPeerConnection(): RTCPeerConnection;
|
2018-04-26 15:33:47 +02:00
|
|
|
/**
|
|
|
|
* @hidden
|
|
|
|
*/
|
2018-06-01 14:39:38 +02:00
|
|
|
subscribeToMyRemote(value: boolean): void;
|
2018-04-26 15:33:47 +02:00
|
|
|
/**
|
|
|
|
* @hidden
|
|
|
|
*/
|
|
|
|
setOutboundStreamOptions(outboundStreamOpts: OutboundStreamOptions): void;
|
|
|
|
/**
|
|
|
|
* @hidden
|
|
|
|
*/
|
|
|
|
subscribe(): Promise<any>;
|
|
|
|
/**
|
|
|
|
* @hidden
|
|
|
|
*/
|
|
|
|
publish(): Promise<any>;
|
|
|
|
/**
|
|
|
|
* @hidden
|
|
|
|
*/
|
|
|
|
disposeWebRtcPeer(): void;
|
|
|
|
/**
|
|
|
|
* @hidden
|
|
|
|
*/
|
|
|
|
disposeMediaStream(): void;
|
|
|
|
/**
|
|
|
|
* @hidden
|
|
|
|
*/
|
|
|
|
displayMyRemote(): boolean;
|
|
|
|
/**
|
|
|
|
* @hidden
|
|
|
|
*/
|
|
|
|
isSendAudio(): boolean;
|
|
|
|
/**
|
|
|
|
* @hidden
|
|
|
|
*/
|
|
|
|
isSendVideo(): boolean;
|
|
|
|
/**
|
|
|
|
* @hidden
|
|
|
|
*/
|
|
|
|
isSendScreen(): boolean;
|
|
|
|
/**
|
|
|
|
* @hidden
|
|
|
|
*/
|
|
|
|
setSpeechEventIfNotExists(): void;
|
|
|
|
/**
|
|
|
|
* @hidden
|
|
|
|
*/
|
|
|
|
enableSpeakingEvents(): void;
|
|
|
|
/**
|
|
|
|
* @hidden
|
|
|
|
*/
|
|
|
|
enableOnceSpeakingEvents(): void;
|
|
|
|
/**
|
|
|
|
* @hidden
|
|
|
|
*/
|
|
|
|
disableSpeakingEvents(): void;
|
2018-12-14 14:01:16 +01:00
|
|
|
/**
|
|
|
|
* @hidden
|
|
|
|
*/
|
|
|
|
enableVolumeChangeEvent(): void;
|
|
|
|
/**
|
|
|
|
* @hidden
|
|
|
|
*/
|
|
|
|
enableOnceVolumeChangeEvent(): void;
|
|
|
|
/**
|
|
|
|
* @hidden
|
|
|
|
*/
|
|
|
|
disableVolumeChangeEvent(): void;
|
2018-06-01 14:39:38 +02:00
|
|
|
/**
|
|
|
|
* @hidden
|
|
|
|
*/
|
|
|
|
isLocal(): boolean;
|
2018-06-27 16:29:31 +02:00
|
|
|
/**
|
|
|
|
* @hidden
|
|
|
|
*/
|
|
|
|
getSelectedIceCandidate(): Promise<any>;
|
|
|
|
/**
|
|
|
|
* @hidden
|
|
|
|
*/
|
|
|
|
getRemoteIceCandidateList(): RTCIceCandidate[];
|
|
|
|
/**
|
|
|
|
* @hidden
|
|
|
|
*/
|
|
|
|
getLocalIceCandidateList(): RTCIceCandidate[];
|
|
|
|
private initWebRtcPeerSend;
|
|
|
|
private initWebRtcPeerReceive;
|
2018-07-11 11:47:53 +02:00
|
|
|
private remotePeerSuccessfullyEstablished;
|
2018-06-27 16:29:31 +02:00
|
|
|
private initWebRtcStats;
|
|
|
|
private stopWebRtcStats;
|
|
|
|
private getIceServersConf;
|
2018-04-26 15:33:47 +02:00
|
|
|
}
|