【问题标题】:Start a video at a particular time and keep track of the video在特定时间开始播放视频并跟踪视频
【发布时间】:2021-08-15 09:06:01
【问题描述】:

这是一个两部分的问题。

我正在使用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>
    

【问题讨论】:

  • @boxdox 这个可以和 Typescript/angular 一起使用吗?对不起,我是新手
  • 这是一个浏览器属性,所以它应该可以工作。试一次

标签: angular typescript azure html5-video azure-media-player


【解决方案1】:

请参阅AMP docsAPI 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);

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2023-02-22
    • 2022-07-22
    • 1970-01-01
    • 1970-01-01
    • 2014-04-07
    • 1970-01-01
    • 2022-12-14
    相关资源
    最近更新 更多