import { IStreamEventProperties } from './streamEventProperties'; import { ITrackInfo } from './IStreamTrackInfo'; /** * Generic interface for stream events. */ export interface IStreamEvent { /** * Type of the event. * @see {@link StreamEventType} */ type: T; /** * Additional stream properties that are relevant to the event. * If there is more than one stream active, this will contain the properties of the stream that emitted the event. */ srcArguments: IStreamEventProperties; } /** * Stream Error Event, which is emitted when an error occurs during stream operations. */ export interface IStreamErrorEvent extends IStreamEvent<'error'> { /** * Additional info about the error that occurred, if any info is available. */ errorMessage?: string | undefined; } /** * Stream Tracks Changed Event which is emitted when new track is selected or active track resets. */ export interface IStreamTracksChangedEvent extends IStreamEvent<'tracks_changed'> { /** * Additional info about the track which has occurred the event. */ tracks: ITrackInfo[] | undefined; } /** * List of all possible stream event types. */ export type StreamEventType = 'connected' | 'disconnected' | 'error' | 'stop' | 'play' | 'prepare' | 'pause' | 'resume' | 'tracks_changed';