简体   繁体   中英

Setting source to a azure media player

I have a azure media player embedded in my SharePoint page. 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.

However the source is not being set or it throws some error. Please find the code below.

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

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

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

Also, I'm not sure if this was a typo or not but you have "type": included in your code twice.

Please refer to https://amp.azure.net/libs/amp/latest/docs/ .

Authentication token of a sharepoint videoportal file can be retreived using GetStreamingKeyAccessToken rest service.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM