简体   繁体   中英

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,

You can specify the heuristic profile (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

try something like this:

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

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