klemens / ff-youtube-all-html5

Play all videos on YouTube with your preferred settings (size, quality, playback rate, …) without cookies using only HTML5
https://addons.mozilla.org/de/firefox/addon/youtube-all-html5/
34 stars 9 forks source link

Support for Youtube SPF #52

Open look997 opened 9 years ago

look997 commented 9 years ago

Please use this code to support for Youtube SPF

    var MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver;
    var observer = new MutationObserver(function(mutations) {
        if (mutations[0].attributeName === 'class' && mutations[0].target.classList.contains("page-loaded")) {
            // your code
        }
    });

    observer.observe(document.querySelector('body'), {attributes: true} );
klemens commented 9 years ago

I just checked the current implementation and it still seems to work fine (except for the quality settings). Do you have any specific problems? Having said that, checking for page-loaded indeed seems much more sensible than the current approach.

look997 commented 9 years ago

Yes. Start videos paused and quality settings.

klemens commented 9 years ago

Implementing the former should be no problem, the quality-settings however rely on being run before any of the youtube code has the chance to run, which is why the addon disables spf by default.