简体   繁体   English

Microsoft Azure Media Player在定义的时间开始

[英]Microsoft Azure Media Player Start At Defined Time

I have just started familiarising the azure media player and need to achieve setting the video to a defined timeframe at load.The code I have used so far is as follows.The reference used in the application also as part of the question. 我刚刚开始熟悉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 looked at this URL but not provided full code or not feeling any difference to what I tried? 设置Azure媒体播放器的开始时间时已查看此URL,但未提供完整代码,或者与我尝试的内容没有任何不同?

As mentioned in the linked thread there are two ways to achieve this depending on your specific scenario. 链接线程中所述,有两种方法可以实现此目标,具体取决于您的特定方案。 If you want to start at a specific time because there is a preroll slate (or like content that you don't care for your user to see), you should use the dynamic manifests in Azure Media Services. 如果您希望在特定时间开始,因为有预卷选项(或喜欢您不希望用户看到的内容),则应使用Azure Media Services中的动态清单。 This is the recommended method and is generally the main scenario. 这是推荐的方法,通常是主要方案。

Also, as mentioned in the linked thread, if you wish to have done specifically in the player (so that means the content is actually viewable but just want to start at a specific time), you should listen for the play or playing event and set the currentTime after that point. 另外,如链接线程中所述,如果您希望在播放器中专门完成操作(这意味着内容实际上是可见的,但只想在特定时间开始),则应收听播放或播放事件并进行设置该点之后的currentTime。

A simple way to do this is directly after setting the source of Azure Media Player: 一种简单的方法是直接在设置Azure Media Player的源之后:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM