设置Azure Media Player的开始时间 [英] Set begin time of Azure Media Player

查看:143
本文介绍了设置Azure Media Player的开始时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在特定时间启动AMP(Azure Media Player)HTML5视频,以显示视频的特定内容.

I want to start a AMP(Azure Media Player) HTML5 video on specific time to show specific content of the video.

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

What does not work is the time to start. The videos always start at 0:00 and then plays nicely to the end. No useful notifications in js console.

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

I read through some examples and the documentation and this is what I have tried, (note the line 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>

我使用以下来源进行设置. 链接到我使用过的文档

I have used the following source to set this up. Link to documentation I have used

推荐答案

用以下内容替换HTML视频标记,它将在设置的时间开始.它正在设置产生currentTime(30)的源;不运行.

Replace the HTML video tag with the following and it will start at the set time. It was setting the source that made currentTime(30); to not run.

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

这篇关于设置Azure Media Player的开始时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆