Processing
 

Increase (youtube flash) video's sound volume by means of JavaScript

30/07/2011 20:25#1

Joined at: 7 months ago

Post: 1

Thank: 0

Thanked: 0

Background story: many users (including me) browse the web from notebooks that are not constructed for sound performance. That means (besides other things) that the sound volume for most videos is too low, especially if the video itself is recorded at low volume.

Therefore...

I was wondering if there is any way of increasing the volume of such a video (especially Youtube, but could be extended to other types), because I'm interested in doing it and even publishing it as Firefox/Chrome/other browser plug-in.

Or, alternatively, if you know such a plug-in do not hesitate to post the link here.

30/07/2011 22:59Top#2

serg

Member

Joined at: 10 months ago

Post: 441

Thank: 0

Thanked: 0

If you want to control system volume then JavaScript has no direct access to it, you would need to write NPAPI (C++ dll) plugin.

If you want to just adjust video player's own volume (you won't be able to increase it beyond 100%) then JavaScript can do it, perhaps.

If video player is HTML5 <video> tag then controlling volume is easy. For YouTube it would be:

document.getElementsByClassName("video-stream")[0].volume = 0.5; //50% 

If it is a custom made flash player then you need to rely on its JavaScript interface, if any. Youtube player happens to support controlling volume with JavaScript:

document.getElementById("movie_player").setVolume(50); 

In order for this to work you would need to break out of extension sandbox first by injecting <script> tag on the page with this code.

There is no universal solution, you would need to deal with each site individually.

22/05/2012 12:06Top#3

Marco

Member

Joined at: 10 months ago

Post: 93

Thank: 0

Thanked: 0

Use VLC Media Player. You can copy and paste links into it. Increase sound to up to 250%

09/08/2011 14:08Top#4

Joined at: 10 months ago

Post: 73

Thank: 0

Thanked: 0

You can use js-ctypes to change system's volume level. Here is an example that sets volume to 12.5%:

Components.utils.import("resource://gre/modules/ctypes.jsm"); var lib = ctypes.open("winmm.dll"); var waveOutSetVolume = lib.declare("waveOutSetVolume", ctypes.default_abi,                                    ctypes.uint32_t,                                    ctypes.int32_t, ctypes.uint32_t); waveOutSetVolume(-1, 0x20002000); lib.close(); 

However, this only changes the volume for the Firefox process. It won't have any effect on Flash because it runs in a different process now. I'm not even sure whether winmm has some way to change the global volume at all, you might need the new MMDevice API for that - and then it gets complicated because doing COM calls via js-ctypes IMHO isn't possible. Only option is creating your own library to be distributed along with your extension. That should do the COM messaging and export a plain API that can be called via js-ctypes.

21/02/2016 16:45Top#5

Joined at: 7 months ago

Post: 1

Thank: 0

Thanked: 0

You can use Sound Booster software by Letasoft, but there are some things you might encounter like crash, we are using netbooks so the built-in sound card has limit. So try to buff first before playing that's the best advice that I can give. The max volume output will be 500%.

Similar articles

Open a folder in finder/explorer from a webpage?

5 years ago - Reply: 2 - Views: 80

How do I escape a reserved word in Actionscript?

5 years ago - Reply: 2 - Views: 198

Save PPS/PPT files as SWF using C#

5 years ago - Reply: 2 - Views: 171

Ways of making a graphic/visual novel in flash

6 years ago - Reply: 3 - Views: 114

Use PhoneGap + HTML5 and an Embedded Flash Movie

5 years ago - Reply: 2 - Views: 96

View word docs and PDF in browser?

5 years ago - Reply: 2 - Views: 51

ActionScript 3 Read JPEG quality

7 years ago - Reply: 2 - Views: 59

Export/Test Movie Issues

5 years ago - Reply: 3 - Views: 38

Flash always on top in Android browser workaround?

5 years ago - Reply: 2 - Views: 149

Sending Json Form from Flash AS3

5 years ago - Reply: 2 - Views: 29

parsing a swf/fla (using php?)

6 years ago - Reply: 2 - Views: 44

Getting high FPS on Flash/AIR games for mobile?

4 years ago - Reply: 2 - Views: 58

vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re