UNPKG

@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

61 lines (60 loc) 2.61 kB
import { EventBus } from '../events/EventBus'; import { HMSPlaylistItem, HMSPlaylistManager, HMSPlaylistProgressEvent, HMSPlaylistType } from '../interfaces'; import { HMSSdk } from '../sdk'; import { TypedEventEmitter } from '../utils/typed-event-emitter'; export declare class PlaylistManager extends TypedEventEmitter<{ newTrackStart: HMSPlaylistItem<any>; playlistEnded: HMSPlaylistType; currentTrackEnded: HMSPlaylistItem<any>; }> implements HMSPlaylistManager { private sdk; private eventBus; private state; private audioManager; private videoManager; private readonly TAG; constructor(sdk: HMSSdk, eventBus: EventBus); getList<T>(type?: HMSPlaylistType): HMSPlaylistItem<T>[]; setList<T>(list: HMSPlaylistItem<T>[]): void; clearList(type: HMSPlaylistType): Promise<void>; removeItem(id: string, type: HMSPlaylistType): Promise<boolean>; seek(value: number, type?: HMSPlaylistType): void; seekTo(value: number, type?: HMSPlaylistType): void; setVolume(value: number, type?: HMSPlaylistType): void; getVolume(type?: HMSPlaylistType): number; getCurrentTime(type?: HMSPlaylistType): number; getCurrentIndex(type?: HMSPlaylistType): number; getCurrentProgress(type?: HMSPlaylistType): number; getCurrentSelection(type?: HMSPlaylistType): HMSPlaylistItem<any> | undefined; isPlaying(type?: HMSPlaylistType): boolean; setIsAutoplayOn(type: HMSPlaylistType | undefined, autoplay: boolean): void; getPlaybackRate(type?: HMSPlaylistType): number; setPlaybackRate(type: HMSPlaylistType | undefined, value: number): void; setEnabled(enabled: boolean, { id, type }: { id: string; type: HMSPlaylistType; }): Promise<void>; playNext(type?: HMSPlaylistType): Promise<void>; playPrevious(type?: HMSPlaylistType): Promise<void>; stop(type?: HMSPlaylistType): Promise<void>; cleanup(): void; onProgress(fn: (progress: HMSPlaylistProgressEvent) => void): void; onNewTrackStart<T>(fn: (item: HMSPlaylistItem<T>) => void): void; onPlaylistEnded(fn: (type: HMSPlaylistType) => void): void; onCurrentTrackEnded<T>(fn: (item: HMSPlaylistItem<T>) => void): void; private getElement; private removeTracks; private play; private isItemCurrentlyPlaying; private setDuration; private pause; private handlePausePlaylist; private addListeners; /** * Remove tracks if reached the end of list otherwise play next * @param {HMSPlaylistType} type */ private handleEnded; private addTrack; private removeTrack; }