J
J
JackBoner2013-11-24 22:33:13
JavaScript
JackBoner, 2013-11-24 22:33:13

How to change the default quality of Youtube video transmission in VideoJS player?

I installed a VideoJS player on my site . Installed streamer from youtube . Everything works fine, but by default the YouTube video comes in SD quality, i.e. 360. How can I change it to HD? Apparently, the desired parameter is stored somewhere in the vjs.youtube.js file. Here is an excerpt from this file;

videojs.Youtube.prototype.onPlaybackQualityChange = function (a) {
    switch (a) {
    case "medium":
        this.player_.videoWidth = 480;
        this.player_.videoHeight = 360;
        break;
    case "large":
        this.player_.videoWidth = 640;
        this.player_.videoHeight = 480;
        break;
    case "hd720":
        this.player_.videoWidth = 960;
        this.player_.videoHeight = 720;
        break;
    case "hd1080":
        this.player_.videoWidth = 1440;
        this.player_.videoHeight = 1080;
        break;
    case "highres":
        this.player_.videoWidth = 1920;
        this.player_.videoHeight = 1080;
        break;
    case "small":
        this.player_.videoWidth = 320;
        this.player_.videoHeight = 240;
        break;
    default:
        this.player_.videoWidth = 0, this.player_.videoHeight = 0
    }
    this.player_.trigger("ratechange")
};

this part of the code made me think that it is somehow possible to switch the default value.
But the line
this.player_.videoWidth = 0, this.player_.videoHeight = 0

definitely not responsible for this.
Full file
Player is pretty good, it has a lot of advantages, and you don't want to refuse it because of one little thing.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question