Raw Source
gvvad / YouTube video/mp4

// ==UserScript==
// @name        YouTube video/mp4
// @version     0.2
// @description Plays video in h.264 format.
// @author      gvvad
// @match       *.youtube.com/*
// @run-at      document-start
// @license     GPL-3.0+; http://www.gnu.org/licenses/gpl-3.0.txt
// @namespace   https://greasyfork.org/users/100160
// @updateURL   https://openuserjs.org/meta/gvvad/YouTube_speed_rememberer.meta.js
// ==/UserScript==

(function() {
    function a() {
        this.ytplayer = this.ytplayer || {};
        this.ytplayer._config = {};
        Object.defineProperty(ytplayer, "config", {
            get: function() {
                return this._config;
            },
            set: function(value) {
                this._config = value || {};
                try {
                    var splt = value.args.adaptive_fmts.split(",");
                    for(i = 0; i < splt.length; i++) {
                        if(splt[i].indexOf("webm") >= 0) {
                            splt.splice(i, 1);
                            i--;
                        }
                    }
                    this._config.args.adaptive_fmts = splt.join(",");
                    //I don`t know why, but without this not working loadables videos...
                    this._config.loaded = false;
                } catch(e) {}
            },
            configurable: true,
            enumerable: true
        });
    }
    try {
        //Get Global window object
        var g = Function("return this")();
        a.call(g);
    } catch(e) {}
})();