textalive-app-api - v0.5.2
    Preparing search index...

    Interface Timer

    Timer

    Player の音源の再生状態を管理するクラスが実装するインタフェースです。

    Classes that manage music playback for Player should implement this interface.

    interface Timer {
        isPlaying: boolean;
        position: number;
        volume: number;
        wait: number;
        dispose(): void;
        initialize(options: TimerInitOptions): Promise<void>;
        pause(): void;
        play(): void;
        seek(position: number): void;
        stop(): void;
    }

    Implemented by

    Index
    isPlaying: boolean

    再生中かどうか

    Whether the music source is being played or not

    position: number

    現在の再生位置 [ms]

    Timer 実装クラスはこの値をリアルタイムに計算して返さなくてはなりません。 他にも再生位置を返す API が以下の2種類用意されていますが、実装手法の違いにより、この API が常に最も精確な値を返します。

    この API を利用するアプリでは、動画のシーク操作に対応するために PlayerEventListener.onVideoSeekStart PlayerEventListener.onVideoSeek PlayerEventListener.onVideoSeekEnd イベントを適切にハンドルする必要があります。

    Current playback position [ms]

    Timer implementations need to calculate this property value in real time. While there are two other APIs to retrieve the current playback position as follows, this one returns the most precise value.

    Applications utilizing this API need to handle PlayerEventListener.onVideoSeekStart PlayerEventListener.onVideoSeek PlayerEventListener.onVideoSeekEnd events appropriately so that the applications respond to the video seeking operation.

    volume: number

    再生音量 [0-100]

    Playback volume [0-100]

    wait: number

    再生位置情報の更新間隔 [ms]

    Interval for updating playback position [ms]

    • この Timer を破棄する

      Dispose this Timer instance

      Returns void

    • Timer の初期化(動画データの読み込みプロセスで一度だけ呼ばれます)

      Initialize this Timer instance (called during the video data loading process)

      Parameters

      • options: TimerInitOptions

        初期化オプション / Options for initalization process

      Returns Promise<void>

    • 再生を一時停止する

      Pause music playback

      Returns void

    • 再生を開始する

      Start music playback

      Returns void

    • 再生位置を指定する

      Seek specified position in the current music playback

      Parameters

      • position: number

        再生位置 [ms] / Media position [ms]

      Returns void

    • 再生を停止する(一時停止したうえで先頭に巻き戻しする)

      Stop music playback (pause and then seek the beginning)

      Returns void