javascriptreactjsazureazure-media-servicesazure-media-player

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,


Solution

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