[英]Setting source to a azure media player
I have a azure media player embedded in my SharePoint page. 我的SharePoint页面中嵌入了一个Azure媒体播放器。 The source to the file to be played is set dynamically through a script file.Th source files can be of wmv/mp4/mpg formats and retrived from a sharepoint video portal. 要播放的文件的源是通过脚本文件动态设置的。源文件可以是wmv / mp4 / mpg格式,可以从sharepoint视频门户检索。
However the source is not being set or it throws some error. 但是,未设置源,否则会引发一些错误。 Please find the code below. 请在下面找到代码。
HTML: HTML:
<video id="vid1" class="azuremediaplayer amp-default-skin video-responsive" autoplay controls width="100%" height="100%" poster="poster.jpg">
<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>
JS: JS:
var myPlayer = amp('vid1', { /* Options */
"nativeControlsForTouch": false,
autoplay: false,
controls: true,
width: "640",
height: "400",
poster: ""
}, function() {
console.log('Good to go!');
// add an event listener
this.addEventListener('ended', function() {
console.log('Finished!');
});
}
);
myPlayer.src([{
"src": "<<URL to the source file in video portal>>",
"type": "type": "application/vnd.ms-sstr+xml"
}]);
The mime type you're using in your given code implies that you're trying to set a smoothstreaming source (application/vnd.ms-sstr+xml) if you are setting the source as an MP4 you should use the mime type video/mp4 您在给定代码中使用的MIME类型表示如果您要将源设置为MP4,则应尝试设置平滑流源(application / vnd.ms-sstr + xml),而应使用video / MP4
myPlayer.src([{ src: "YOUR_SOURCE.mp4", type: "video/mp4" }]);
you can check out this sample which plays back progressive MP4 content from the Azure Media Player samples page 您可以从Azure Media Player 示例页面中检出该示例以播放渐进MP4内容
Also, I'm not sure if this was a typo or not but you have "type":
included in your code twice. 另外,我不确定这是否是拼写错误,但您有两次"type":
在代码中包含两次。
Please refer to https://amp.azure.net/libs/amp/latest/docs/ . 请参考https://amp.azure.net/libs/amp/latest/docs/ 。
Authentication token of a sharepoint videoportal file can be retreived using GetStreamingKeyAccessToken rest service. 可以使用GetStreamingKeyAccessToken rest服务获取共享点视频门户文件的身份验证令牌。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.