How to disable video loading?



  • Hello
    How can I disable video loading but sound still loading as in the image?lol.png



  • @haquangchi said in How to disable video loading?:

    Hello
    How can I disable video loading but sound still loading as in the image?!

    Have you tried to find a solution to your question on the forum?



  • @Fox
    I tried to find solution on the forum, But I don't see solution for my problem.



  • @haquangchi
    Someone suggest using request mask deny with match (player, hqdefault, mqdefault). But they don't work.



  • @haquangchi
    Use "Execute On Every Page Load In Browser" and try below code

    var observer = new MutationObserver(function(mutations) {
        mutations.forEach(function(mutation) {
            if (mutation.addedNodes && mutation.addedNodes.length > 0) {
                var videos = mutation.target.querySelectorAll('video');
                videos.forEach(function(video) {
                    var sources = video.querySelectorAll('source');
                    sources.forEach(function(source) {
                        var src = source.src;
                        var type = source.type;
                        var audio = document.createElement('audio');
                        audio.setAttribute('src', src);
                        audio.setAttribute('type', type);
                        audio.setAttribute('controls', 'controls');
                        video.parentNode.insertBefore(audio, video);
                    });
                    video.style.display = 'none';
                });
            }
        });
    });
    
    document.addEventListener('DOMContentLoaded', function() {
        var videos = document.querySelectorAll('video');
        videos.forEach(function(video) {
            var sources = video.querySelectorAll('source');
            sources.forEach(function(source) {
                var src = source.src;
                var type = source.type;
                var audio = document.createElement('audio');
                audio.setAttribute('src', src);
                audio.setAttribute('type', type);
                audio.setAttribute('controls', 'controls');
                video.parentNode.insertBefore(audio, video);
            });
            video.style.display = 'none';
        });
        
        var targetNode = document.body;
        var config = { childList: true, subtree: true };
        observer.observe(targetNode, config);
    });
    
    

Log in to reply