首页 > 解决方案 > Is it possible to select a quality for the azure media player using its javascript API?

问题描述

Looking to implement azure media player for a project. But we need to use our existing custom video controls. Is it possible to control the quality selector by javascript? Have not been able to find anything concerning this in the documentation..

Does anyone have experience with this?

Any help would be appreciated!

Could also be worth noting that this is a react.js project.

Thanks,

标签: javascriptreactjsazureazure-media-servicesazure-media-player

解决方案


您可以指定启发式配置文件(HighQuality、Hybrid、LowLatency、QuickStart):

http://amp.azure.net/libs/amp/latest/docs/index.html#amp.player.heuristicprofile

http://amp.azure.net/libs/amp/latest/docs/#amp.videostream.selecttrackbyindex

尝试这样的事情:

myPlayer.addEventListener(amp.eventName.loadedmetadata,
    function() {

        var stream = myPlayer.currentVideoStreamList().streams ?
            myPlayer.currentVideoStreamList().streams[0] :
            undefined;

        if (stream) {
            stream.selectTrackByIndex(0);
        }

    });



myPlayer.src([{
    src: "[srcuri]",
    type: "application/vnd.ms-sstr+xml"
}]);

推荐阅读