FrameworkStyle

selectTime

Select the time state slice from the player store

Pass selectTime to PlayerController to subscribe to time state. Returns undefined if the time feature is not configured.

The returned state includes currentTime, duration, and the seek action method.

import { createPlayer, MediaElement } from '@videojs/html';
import { videoFeatures } from '@videojs/html/video';
import { selectTime } from '@videojs/core/dom';

const { PlayerController, context } = createPlayer({ features: videoFeatures });

class TimeDisplay extends MediaElement {
  #time = new PlayerController(this, context, selectTime);
}

API Reference

Parameters

Parameter Type Default
state* object

Return Value

MediaTimeState | undefined