@100mslive/hms-video-store
Version:
@100mslive Core SDK which abstracts the complexities of webRTC while providing a reactive store for data management with a unidirectional data flow
74 lines (73 loc) • 2.81 kB
TypeScript
import { HMSTrackType } from './HMSTrackType';
import { HMSMediaStream } from '../streams';
export declare type HMSTrackSource = 'regular' | 'screen' | 'plugin' | 'audioplaylist' | 'videoplaylist' | string;
export declare abstract class HMSTrack {
/**
* @internal
*/
readonly stream: HMSMediaStream;
source?: HMSTrackSource;
peerId?: string;
transceiver?: RTCRtpTransceiver;
/**
* @internal to print as a helpful identifier alongside logs
*/
logIdentifier: string;
/** The native mediastream track, for local, this changes on mute/unmute(for video),
* and on device change.
* @internal */
nativeTrack: MediaStreamTrack;
/**
* Firefox doesn't respect the track id as sent from the backend when calling peerconnection.ontrack callback. This
* breaks correlation of future track updates from backend. So we're storing the sdp track id as present in the
* original offer along with the track as well and will let this override the native track id for any correlation
* purpose.
* This applies for remote tracks only.
* @internal */
private sdpTrackId?;
/**
* @internal
* The local track id is changed on mute/unmute or when device id changes, this is abstracted as an internal
* detail of HMSTrack and the variable is used for this enacapsulation where the first track id is remembered
* and treated as the fixed track id for this HMSTrack. This simplifies things for the user of the sdk who
* do not have to worry about changing track IDs.
* This applies for local tracks only.
*/
private firstTrackId?;
abstract readonly type: HMSTrackType;
get enabled(): boolean;
/**
* firstTrackId => encapsulates change in local track ids
* sdpTrackId => fixes remote track updates correlation on firefox
*/
get trackId(): string;
getMediaTrackSettings(): MediaTrackSettings;
setEnabled(value: boolean): Promise<void>;
protected constructor(stream: HMSMediaStream, track: MediaStreamTrack, source?: HMSTrackSource);
/**
* @internal
*/
setSdpTrackId(sdpTrackId: string): void;
/**
* @internal
*/
protected setFirstTrackId(trackId: string): void;
isTrackNotPublishing: () => boolean;
/**
* @internal
* It will send event to analytics when interruption start/stop
*/
sendInterruptionEvent({ started, reason }: {
started: boolean;
reason: string;
}): import("../../analytics/AnalyticsEvent").default;
/**
* @internal
* take care of -
* 1. https://bugs.chromium.org/p/chromium/issues/detail?id=1232649
* 2. stopping any tracks
* 3. plugins related cleanups and stopping
*/
cleanup(): void;
toString(): string;
}