简体   繁体   English

如何将dash.js-2.6.1视频播放器设置为仅以特定的比特率播放而不使用播放器控制栏上的相关复选框?

[英]How to set dash.js-2.6.1 video player to play just on a specific bitrate without using the related check box on player's control bar?

I want to control dash.js-2.6.1 video player remotely so that I could make it play the video at a specific bitrate from the bitrate list it catches from (*.mpd) manifest file. 我想远程控制dash.js-2.6.1视频播放器,以便可以使其从(* .mpd)清单文件中捕获的比特率列表中的特定比特率播放视频。 It's obvious that this can be done using the bitrate checkbox of the player located on control bar of the player's window, but I want to do this in the background, remotely and several times during video playback. 显然,可以使用位于播放器窗口控制栏上的播放器的比特率复选框来完成此操作,但是我想在后台,远程和在视频播放期间多次执行此操作。 In other words, I want to find out which function in the source code of the player catches the bitrate value chosen by the user on the checkbox and feed that function manually and remotely. 换句话说,我想找出播放器源代码中的哪个功能捕获了用户在复选框上选择的比特率值,并手动和远程提供了该功能。

I will appreciate anyone who guides me how to reach my goal even through another method. 我将不胜感激任何引导我如何甚至通过另一种方法达到目标的人。

Look at the MediaPlayer.js source: 查看MediaPlayer.js源代码:

The function you want to look at is 'setQualityFor': 您要查看的功能是“ setQualityFor”:

/**
     * Sets the current quality for media type instead of letting the ABR Heuristics automatically selecting it.
     * This value will be overwritten by the ABR rules unless setAutoSwitchQualityFor(type, false) is called.
     *
     * @param {string} type - 'video' or 'audio'
     * @param {number} value - the quality index, 0 corresponding to the lowest bitrate
     * @memberof module:MediaPlayer
     * @see {@link module:MediaPlayer#setAutoSwitchQualityFor setAutoSwitchQualityFor()}
     * @see {@link module:MediaPlayer#getQualityFor getQualityFor()}
     * @instance
     */
    function setQualityFor(type, value) {
        if (!playbackInitialized) {
            throw PLAYBACK_NOT_INITIALIZED_ERROR;
        }
        abrController.setPlaybackQuality(type, streamController.getActiveStreamInfo(), value);
    }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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