You need to be logged in to post in the forums. If you do not have an account, please sign up first.
Disable HTML5 video
One thing I really liked about Opera when I first started using it was that I could easily disable all plugins so I wasn't browsing the web with annoying flash adverts and could open multiple youtube tabs without having all the videos play at once.However, I have recently come across a few sites using HTML5 video which plays automatically and very loudly.
I've searched around and had a look at the config file and haven't been able to find a way to either disable html5 video or prevent it playing automatically. If in the future more sites are going to start forcing video on us using html5 it would be nice to have a way to turn it off.
The reason for the autoplay attribute should be that annoying people won't script their annoying Javascripts and that we can disable it with a simple browser preference.
[ Tweedo Monitor - Deluxe Website & Service Monitoring ]
If you need any help from me with regards to Opera, please make a comment on any of my blog posts.
Support Opera wishes
video { display: none !important; }
Point opera:config#UserPrefs|BrowserCSSFile to the file you've saved. That should be a quick and dirty way to disable videos — but there's no convenient way to then activate them. Though I imagine someone less lazy than me could come up with a fairly simple User JavaScript/Extension that would do a better job.
A configuration setting like you get for plugins would be appreciated though.
MyOpera Community Optimizations — by fearphage
Scribit improved posting tools for the MyOpera Community — by xErath
Improve Weeklies Blog — by MisterE & fearphage
Originally posted by BtEO:
Though I imagine someone less lazy than me could come up with a fairly simple User JavaScript/Extension that would do a better job.
As long as User JavaScripts/Extensions require JavaScript to be enabled in the browser they are not an option! At least by far not for standards Opera is claiming.
Every morning a lion wakes up. It knows it must outrun the slowest gazelle or it will starve to death.
It doesn't matter whether you are a lion or a gazelle: when the sun comes up, you'd better be running.
24. August 2011, 20:38:10 (edited)
Originally posted by BtEO:
Point opera:config#UserPrefs|BrowserCSSFile to the file you've saved. That should be a quick and dirty way to disable videos — but there's no convenient way to then activate them. Though I imagine someone less lazy than me could come up with a fairly simple User JavaScript/Extension that would do a better job.
Just dump it in the user styles directory instead. Make show popup menu, "internal style list" easily accessible through a keyboard shortcut, button or mouse gesture. Turning it on and off is then a piece of cake.
Originally posted by BtEO:
Though I imagine someone less lazy than me could come up with a fairly simple User JavaScript/Extension that would do a better job.
I already did, last year. Well, sort of. To tell you the truth I never imagined we'd still be waiting for control over such issues, so I never actually finished anything. Anyone's free to pick it up; it's not like it's in any way a complicated script. I've got no time this and next week to do anything, plus I'm not actually sufficiently bothered by HTML5 stuff yet.
I also wrote another audio/video related script. It demos querySelectorAll for those who don't know what it is, and could conceivably be used to come to a solution quicker. Specifically, just replace the src attribute and source element selectors with ones for autoplay and then get rid of it/set it to false.
HTML5 video keeps crashing my computer!!
I want to turn it off.
One of the founding principles of Opera is to let the user turn off images, javascript, cookies, Flash, Animated images etc all nice and easily in the F12 menu or custom checkboxes on the status bar.
It must be done.
7. February 2012, 05:25:32 (edited)
Also, with userjs, you can make play() on the audio/video object do nothing if you want:
HTMLMediaElement.prototype.play = function() {
};
You an override other methods if needed.
You can also cache HTMLMediaElement.prototype.play. Then, you can override it/restore it with a keyboard shortcut.
And, there's already the browser.css method mentioned to patch Opera's default stylesheet to hide video/audio elements by defaul. And, there's the user css method to override the page's styles to do the same. But, those methods won't stop the video/audio from playing.
I'm not a web developer, so it took me some time to turn burnout426's tantalizing hints into something that works for me (at least for YouTube and embedded YouTube vids on other sites). No doubt I've committed a few howlers that real JS developers will pick up on. Anyway, here's my userjs:
(function () {
HTMLMediaElement.prototype.playZeMovieYah = HTMLMediaElement.prototype.play;
HTMLMediaElement.prototype.play = function()
{
if (!this.hasOwnProperty('okToPlayZeMovie'))
this.okToPlayZeMovie = confirm("Play multimedia?");
if (this.okToPlayZeMovie)
this.playZeMovieYah();
};
HTMLMediaElement.prototype.load = function()
{
};
})();
Using the boolean 'okToPlayZeMovie' means that I only get the popup once, not every time I pause and restart the movie. And the override for load() prevents autoloading of something I'm not going to play.
It's not quite right yet: if I cancel the popup so as not to play the movie, I still get the annoying circular loading animation looping endlessly. Any ideas on how to stop it?
Originally posted by BOYD1981:
However, I have recently come across a few sites using HTML5 video which plays automatically and very loudly.
+1 for request
http://senna-4ever.com
Still we can have fun with the "SOPA/PIPA thing"
http://www.youtube.com/watch?v=3YQ9Mm4Oz1I
Away Nilzer - CHAEL SONNEN (UFC) - SUBTITLED
http://www.youtube.com/watch?v=S_Kh8U0yDD0
Save the Opera Unite, give us Opera back
http://www.ipetitions.com/petition/openoperaunited/
Originally posted by crapshark:
Anyway, here's my userjs:
Untested, by I'd do it like this:
(function() {
var play = HTMLMediaElement.prototype.play;
HTMLMediaElement.prototype.play = function() {
if (confirm("Play multimedia?")) {
play.call(this);
}
};
})();
As for the animation, don't know. You could add an "else" condition and call this.stop() in it to see if it helps. Or, just add this.stop() before the if (confirm()) part to see if helps.
But, for youtube, you don't need this. Just install the extendtube extension and make sure autoplay is disabled.
Thanks for that ".call(this)" suggestion, burnout426 - it fixes the context problems ('WRONG_THIS_ERR') that induced me to store data in properties-with-funny-names on the HTMLMediaElement itself, which was nasty. I still need the boolean to stop a double pop-up when the page first loads and subsequent ones whenever I restart the video after pausing it. The this.stop() suggestion didn't prevent the load-loop animation, unfortunately.
Here's my new userjs that no longer pollutes the HTMLMediaElement namespace and successfully stops the dollarshaveclub video:
(function () {
var okToPlay;
var play = HTMLMediaElement.prototype.play;
HTMLMediaElement.prototype.play = function()
{
if (typeof okToPlay === 'undefined')
okToPlay = confirm("Play multimedia?");
if (okToPlay)
play.call(this);
};
HTMLMediaElement.prototype.load = function()
{
};
})();
Random freezes and crashes, most likely caused by GStreamer component, are driving me mad too. Unfortunately, nobody is going to debug that weird issues thoroughly.
Originally posted by Lonely Soul:
Just discovered that Opera will forget about its embedded media player if you just remove or rename "gstreamer" folder in Opera's installation directory.Random freezes and crashes, most likely caused by GStreamer component, are driving me mad too. Unfortunately, nobody is going to debug that weird issues thoroughly.
But will it fall back properly?
Originally posted by Lonely Soul:
Fall back to what?
I assume he meant:
<video src="file.ext">
<object type="application/x-shockwave-flash" data="file.swf"></object>
</video>
<video> is only supposed to fall back if the video element isn't supported. So, if you yank out Opera's video support, the object nested in it should load instead, but will it?
Originally posted by burnout426:
I assume he meant:
Indeed I did.