【问题标题】:Setting source to a azure media player将源设置为 azure 媒体播放器
【发布时间】:2016-09-28 09:38:30
【问题描述】:

我的 SharePoint 页面中嵌入了一个 azure 媒体播放器。 要播放的文件的源是通过脚本文件动态设置的。源文件可以是 wmv/mp4/mpg 格式并从共享点视频门户检索。

但是没有设置源或者它会引发一些错误。 请在下面找到代码。

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:

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"
}]); 

【问题讨论】:

  • 页面中的 HTML 代码:

标签: javascript html sharepoint azure-media-services


【解决方案1】:

您在给定代码中使用的 mime 类型意味着您正在尝试设置平滑流源 (application/vnd.ms-sstr+xml) 如果您将源设置为 MP4,则应使用 mime 类型 video/mp4

myPlayer.src([{ src: "YOUR_SOURCE.mp4", type: "video/mp4" }]);

您可以查看this sample,它会从 Azure 媒体播放器samples page 播放渐进式 MP4 内容

另外,我不确定这是否是拼写错误,但您的代码中包含两次 "type":

【讨论】:

  • 谢谢斯拉杰。源文件可以是 wmv/mp4/mpg 类型,因此将 mime 类型设置为 video/mp4 不会修复它。但是我能够通过添加保护信息使播放器工作。
  • 这段代码修复了它。 myPlayer.src([{ "src": source, //指向源的url "type": "application/vnd.ms-sstr+xml", "protectionInfo": [{ "type": "AES", "authenticationToken ":data.value, "disableUrlRewriter": true }] }, ]);
【解决方案2】:

请参考https://amp.azure.net/libs/amp/latest/docs/

可以使用 GetStreamingKeyAccessToken REST 服务获取共享点视频门户文件的身份验证令牌。

【讨论】:

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