eligius
    Preparing search index...

    Class VideoPositionSource

    Video.js-based position source.

    Wraps a video.js player to provide position updates based on video playback. Implements IPositionSource, ISeekable, and IContainerProvider.

    const source = new VideoPositionSource({
    selector: '#video-container',
    sources: [
    { src: 'video.mp4', type: 'video/mp4' },
    { src: 'video.webm', type: 'video/webm' },
    ],
    });

    await source.init();

    source.onPosition((position) => {
    console.log(`Video at ${position}s`);
    });

    source.onContainerReady(() => {
    console.log('Video ready for display');
    });

    await source.activate();

    Hierarchy (View Summary)

    Implements

    Index

    Constructors

    Accessors

    • get loop(): boolean

      Whether to loop when reaching the end boundary.

      When true, the source resets to position 0 and continues. When false, the source emits 'end' boundary and deactivates.

      For sources where looping is not applicable (e.g., mouse position), this property has no effect.

      Returns boolean

    • set loop(value: boolean): void

      Whether to loop when reaching the end boundary.

      When true, the source resets to position 0 and continues. When false, the source emits 'end' boundary and deactivates.

      For sources where looping is not applicable (e.g., mouse position), this property has no effect.

      Parameters

      • value: boolean

      Returns void

    Methods

    • Register a callback for when the source becomes active.

      Called once each time the source transitions to the active state. This is equivalent to "first frame" semantics - for RAF sources it's the first tick, for video sources it's when playback actually starts.

      Parameters

      • callback: () => void

        Function called when source becomes active

      Returns void