eligius
    Preparing search index...

    Class SimplePlaylist<TItem>

    Simple playlist implementation.

    Manages a collection of timeline items and allows switching between them. Implements IPlaylist<TItem> for use with timeline providers that support multiple content sources.

    interface VideoItem {
    id: string;
    uri: string;
    title: string;
    }

    const playlist = new SimplePlaylist<VideoItem>({
    items: [
    { id: 'intro', uri: '/videos/intro.mp4', title: 'Introduction' },
    { id: 'ch1', uri: '/videos/chapter-1.mp4', title: 'Chapter 1' },
    ],
    identifierKey: 'id',
    });

    playlist.onItemChange((item) => {
    console.log(`Now playing: ${item.title}`);
    });

    playlist.selectItem('ch1');

    Type Parameters

    • TItem = unknown

      Type of playlist items

    Implements

    Index

    Constructors

    Accessors

    Methods

    Constructors

    Accessors

    Methods

    • Select an item by identifier.

      Looks up the item using the configured identifier key and switches to it if found. Triggers item change callbacks if the selection changes.

      Parameters

      • identifier: string

        Unique identifier for the item

      Returns void

      Error if no item matches the identifier