【问题标题】:Set begin time of Azure Media Player设置 Azure 媒体播放器的开始时间
【发布时间】:2015-06-23 12:06:52
【问题描述】:

我想在特定时间启动 AMP(Azure 媒体播放器)HTML5 视频以显示视频的特定内容。

不起作用的是开始的时间。视频总是从 0:00 开始,然后播放到最后。 js 控制台中没有有用的通知。

我阅读了一些示例和文档,这就是我尝试过的,(注意 myPlayer.currentTime(30); 行):

脚本:

var myPlayer = amp('vid1', { /* Options */
        "nativeControlsForTouch": false,
        autoplay: false,
        controls: true,
        width: "640",
        height: "400",
        poster: ""
    },
    function () {
        myPlayer.src([{
            src: "http://amssamples.streaming.mediaservices.windows.net/91492735-c523-432b-ba01-faba6c2206a2/AzureMediaServicesPromo.ism/manifest",
            type: "application/vnd.ms-sstr+xml"
        }]);
        myPlayer.currentTime(30);
        console.log('Good to go!');
        this.play(); // if you don't trust autoplay for some reason

        // add an event listener
        this.addEventListener('ended', function () {
            console.log('Finished!');
        });
    });

HTML

<video id="vid1" class="azuremediaplayer amp-default-skin">
        <source src="" type="application/vnd.ms-sstr+xml" />
        <p class="amp-no-js">
            To view this video please enable JavaScript, and consider upgrading to a web browser that supports HTML5 video
        </p>
    </video>

我已使用以下来源进行设置。 Link to documentation I have used

【问题讨论】:

    标签: azure media-player azure-media-services


    【解决方案1】:

    根据您的情况,有两种方法可以实现这一目标。

    如果您的场景是您希望从 30 秒开始,但让用户能够查看时间 0:00-0:30,那么在播放事件之后(设置源之后)设置 currentTime 将起作用.

    如果您的场景是您希望流在 30 秒后开始,但您不希望观众看到前 30 秒(更像是修剪或剪辑的版本,因为前 30 秒可能是空白内容或只是一个静态保险杠),你最好创建一个动态清单。使用动态清单,您可以修剪内容的开始时间(如果需要,还可以添加其他过滤器)以获得更精确的开始时间,而无需创建另一个资产(因为它使用现有资产)。查看 the blog 了解有关动态清单的更多详细信息。

    【讨论】:

    • 我给了你一个+1,因为我认为它增加了答案的价值,但我自己回答了这个问题并一直在等待“2天来设置自我回答”限制。干杯!
    【解决方案2】:

    将 HTML video 标签替换为以下内容,它将在设定的时间开始。正是设置了导致 currentTime(30); 的源不跑。

    <video id="vid1" class="azuremediaplayer amp-default-skin amp-big-play-centered" tabindex="0">  </video>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-02-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多