我刚刚开始熟悉 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/