【问题标题】:Microsoft Azure Media Player Start At Defined TimeMicrosoft Azure 媒体播放器在定义的时间启动
【发布时间】:2015-07-07 11:05:15
【问题描述】:

我刚刚开始熟悉 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查看了这个网址,但没有提供完整的代码,或者感觉与我的尝试没有任何不同?

【问题讨论】:

    标签: asp.net azure azure-media-services


    【解决方案1】:

    正如linked thread 中提到的,有两种方法可以实现这一点,具体取决于您的具体情况。如果您想在特定时间开始,因为有一个预卷板(或您不希望用户看到的类似内容),您应该使用 Azure 媒体服务中的动态清单。这是推荐的方法,通常是主要场景。

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

    一个简单的方法是直接在设置 Azure 媒体播放器的源之后:

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

    【讨论】:

    • 嗨阿米特,感谢您的回复。用户正在观看视频的场景,他暂停了视频并关闭了页面。当时我将当前时间存储在数据库中。下次他访问我需要同时暂停的页面,然后当他点击播放时,它将从该点开始。
    • 那么监听事件是要走的路。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-02-27
    相关资源
    最近更新 更多