在特定时间开始播放视频并跟踪视频

Start a video at a particular time and keep track of the video

这是一个由两部分组成的问题。

我正在使用 Azure Media Player 播放视频。代码如下。我刚刚显示了视频的 URL,它开始播放了。

  1. 我需要知道如何在特定时间播放视频(比如 0.19 秒)

  2. 如何跟踪视频的播放时间

    <video oncontextmenu="return false;"  id="vid1" class="azuremediaplayer amp-default-skin" autoplay width="640" height="400"  data-setup='{"nativeControlsForTouch": false}'>
        <source src={{url}} >
    </video>
    

有关详细信息,请参阅 AMP docs and the API docs

var myPlayer = amp("vid1", function(){
    //this is the ready function and will only execute after the player is loaded

    myPlayer.currentTime(19);  // immediately after the video is ready, this will set the time to 19 seconds
});

// in this case, assume `startCounter` and `stopCounter` are functions
// you created that start and pause a timer to keep track of how long someone
// has actually been playing the content.
myPlayer.addEventListener(amp.eventName.play, startCounter);
myPlayer.addEventListener(amp.eventName.pause, pauseCounter);

// or use `timeupdate` if you would rather just keep track of the current
// playback position.
myPlayer.addEventListener(amp.eventName.timeupdate, someFunc);