Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to set the default HTML5-Video volume?

HTML5 videos always start at 100% volume.

How can I make them start at 50% volume?

like image 290
supercoolville Avatar asked Sep 28 '11 11:09

supercoolville


People also ask

How do you prevent HTML5 video from changing size when loading a new source?

If all you want is really to avoid the width/height to return to defaults (300 x 150) when the next video is loading, you just have to set your <video> 's width and height properties to the ones of the loaded video ( videoWidth and videoHeight are the real values of the media, not the ones of the element).


1 Answers

You can affect the volume property of the <video> element as follows:

document.getElementsByTagName('video')[0].volume = 0.5; 

If using jQuery then you can use their prop method to alter the volume in a jQuery collection object like so:

$("video").prop("volume", 0.5); 

This will alter all DOM elements in the collection.

like image 123
marksyzm Avatar answered Oct 23 '22 01:10

marksyzm