You need to be logged in to post in the forums. If you do not have an account, please sign up first.

Go to last post

24. August 2011, 10:03:20

BOYD1981

Posts: 6

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.

24. August 2011, 10:30:19

Frenzie

Posts: 14438

+1

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.
Intelligent alien life does exist, otherwise they would've contacted us. — CalendarExtend Opera

24. August 2011, 12:10:44

serious

Lab mouse and likes it!

Posts: 5297

+1, same as you can disable images.
All my posts only represent my own opinions.
[ Tweedo Monitor - Deluxe Website & Service Monitoring ]

24. August 2011, 12:35:05

+1.
Windows 7 SP1 x86 edition and Windows XP Service Pack 3.
If you need any help from me with regards to Opera, please make a comment on any of my blog posts.
Support Opera wishes

24. August 2011, 13:03:12

DukePhillips

Posts: 33

+1

I thought controlling how the video element works was one of the points of HTML5 video.

24. August 2011, 15:11:23

tobyink

Posts: 11

Does the "Enable sound in Web pages" quick preference work for <video>?

24. August 2011, 18:27:47

BtEO

Posts: 1018

Create a CSS file with:
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 Enhancements — by xErath & BtEO
MyOpera Community Optimizations — by fearphage
Scribit improved posting tools for the MyOpera Community — by xErath
Improve Weeklies Blog — by MisterE & fearphage

24. August 2011, 19:14:41

Krake

Posts: 2365

+1

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 in Africa, a gazelle wakes up. It knows it must run faster than the fastest lion or it will be killed.
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)

Frenzie

Posts: 14438

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.
Intelligent alien life does exist, otherwise they would've contacted us. — CalendarExtend Opera

22. January 2012, 20:43:16

Barry2000

Posts: 102

+100 Why haven't Opera done this already??

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.

5. February 2012, 01:22:25

ferneu2

Posts: 9

+1

No crashes so far but annoying. Very, very annoying. I wanna to be able to disable useless stuff like this. Opera is supposed to be my LEAN AND MEAN browser.

6. February 2012, 02:41:33

praetor87

Posts: 101

Originally posted by Barry2000:

HTML5 video keeps crashing my computer!!



Yeah, on youtube, when i close the tab before the video loads in. I disabled flash, but i often won't watch html5 video too. down

7. February 2012, 05:25:32 (edited)

burnout426

Posts: 12423

opera:config#Allow%20Autoplay

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.

9. March 2012, 14:23:25

crapshark

Posts: 7

+1

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?

9. March 2012, 17:40:06

ozoratsubasa

Magic Senna

Posts: 1275

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
Win7 32 Opera 11.62 FOREVER!!

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/

9. March 2012, 18:30:48

burnout426

Posts: 12423

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.

12. March 2012, 14:26:58

crapshark

Posts: 7

I didn't know about extendtube - it's a nice extension. However, it doesn't solve the problem for YouTube videos embedded on other sites! They can still autoplay, despite my having opera:config#Allow%20Autoplay unchecked, extendtube's 'Always disable autoplay' checked, extendtube's 'Play on focus' unchecked, and, of course, all plugins disabled. Here's an example of a site that autoplays regardless:http://www.dollarshaveclub.com/

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()
    {
    };
})();

8. April 2012, 13:12:07

+1

as long as html5 videos on yt have this bad performance this is needed unconditionally.

19. May 2012, 17:32:01

Lonely Soul

Posts: 31

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.

19. May 2012, 18:30:55

Frenzie

Posts: 14438

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?
Intelligent alien life does exist, otherwise they would've contacted us. — CalendarExtend Opera

19. May 2012, 20:35:00

Lonely Soul

Posts: 31

Fall back to what? If you have Flash Player plugin installed most of the websites will use it automatically.

20. May 2012, 04:32:14

burnout426

Posts: 12423

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?

20. May 2012, 08:58:06

Frenzie

Posts: 14438

Originally posted by burnout426:

I assume he meant:


Indeed I did.
Intelligent alien life does exist, otherwise they would've contacted us. — CalendarExtend Opera

16. January 2013, 19:25:17

dONALD-Blood

Posts: 23

Seriously, Adobe wants to supply security updates, so why forcing this unoptimized html5 bullsh*t? Not to mention plugin click-to-play stops working with lametml5 enabled. Just make a bloody setting for disabling it for cryin' out loud! And fix the clearing cookies issue...

17. January 2013, 19:40:42

tarc

Posts: 52

+1 to stop autoplaying HTML Video & HTML Audio

Forums » Opera for Windows/Mac/Linux » Desktop wish-list