asp.net - Microsoft Azure 媒体播放器在定义的时间启动

标签 asp.net azure azure-media-services

我刚刚开始熟悉 azure 媒体播放器,需要在加载时将视频设置为定义的时间范围。到目前为止我使用的代码如下。应用程序中使用的引用也作为问题的一部分。

<link href="//amp.azure.net/libs/amp/latest/skins/amp-default/azuremediaplayer.min.css" rel="stylesheet">
<script src="//amp.azure.net/libs/amp/latest/azuremediaplayer.min.js"></script>
<script>
  amp.options.flashSS.swf = "//amp.azure.net/libs/amp/latest/techs/StrobeMediaPlayback.2.0.swf"
  amp.options.flashSS.plugin = "//amp.azure.net/libs/amp/latest/techs/MSAdaptiveStreamingPlugin-osmf2.0.swf"
  amp.options.silverlightSS.xap = "//amp.azure.net/libs/amp/latest/techs/SmoothStreamingPlayer.xap"
</script>



@{
    var ContentUrl = ViewBag.ContentUrl;
}

<video id="vd123" class="azuremediaplayer amp-default-skin amp-big-play-centered">

</video>
<script>

    var myOptions = {
        //"nativeControlsForTouch": false,
        techOrder: ["azureHtml5JS", "flashSS", "silverlightSS", "html5"],
        "nativeControlsForTouch": false,
        autoplay: false,
        controls: true,
        width: "640",
        height: "400",
        poster: ""
    };
    var myPlayer = amp("vd123", myOptions, function () {

    });


    myPlayer.src([
      {
          src: "src",
          type: "application/vnd.ms-sstr+xml"
      },
    ]);
    myPlayer.currentTime(5);
</script>

Set begin time of Azure Media Player查看了此 URL,但未提供完整代码,或者感觉与我尝试的内容没有任何区别?

最佳答案

linked thread 中所述根据您的具体情况,有两种方法可以实现此目的。如果由于存在预卷列表(或不希望用户看到的内容)而希望在特定时间开始,则应使用 Azure 媒体服务中的动态 list 。这是推荐的方法,通常是主要场景。

此外,正如链接线程中提到的,如果您希望在播放器中专门完成(这意味着内容实际上是可见的,但只想在特定时间开始),您应该监听播放或播放事件并在该点之后设置 currentTime。

一种简单的方法是在设置 Azure Media Player 的源后直接执行此操作:

myPlayer.addEventListener(amp.eventName.play, startTime);
function startTime() {
    myPlayer.currentTime(5);
    myPlayer.removeEventListener(amp.eventName.play, startTime)
}

关于asp.net - Microsoft Azure 媒体播放器在定义的时间启动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31266839/

相关文章:

c# - 读取 HTML 数据中的数据

Azure 数据库同步失败

azure - 具有 Azure 媒体服务的多个 RTMP 输出

c# - 为什么这个 JavaScript 不显示确认框?

c# - 从后面的代码向验证摘要添加错误消息

asp.net - 在移动设备上查看时不会显示网页

json - 我可以将 JSON 存储在 Azure Key Vault 中吗

azure - 如何从 Management Studio 2016 中的预装 SQL 脚本创建 Azure 数据库?

Azure 媒体服务/播放器自动启动直播事件

azure - 设置 Azure Media Player 的开始时间