Mute HTML5 Video by default, But allow user to unmute - html

If I add the muted attribute to the tag the video does mute, but the user cannot unmute the video using the default controls.
Is there anyway to have a video load up muted with the ability to unmute using default controls?

Use the muted attributed in order to mute the video.
<video controls muted>
<source src="movie.mp4" type="video/mp4">
<source src="movie.ogg" type="video/ogg">
Your browser does not support the video tag.
</video>

Related

Chrome : my video start in autoplay when accessing the page, but not when reloading the page

All is in the title. When i access a page with a video tag, autoplay works fine.But when i reload the page, the video dont start.
What can i do to auto start the video ?
<video autoplay loop poster="the_poster.jpg" id="bgvid">
<source src="video.mp4" type="video/mp4">
<source src="video.webm" type="video/webm">
<source src="video.ogv" type="video/ogg">
</video>
i try to add a ?ts=timestamp.
i try also to start the video with JS but i get a "promise error"
I've had same issue here and it solved by adding muted attribute to video tag.
For Google Chrome, according to this update note, autoplay with sound needs some conditions. However, Muted autoplay is always allowed.

How to make html5 video tag open fullscreen automatically

I am using html 5 video tag in my ionic project where i has to open a video and play it. Here play, pause and controls are working properly. My requirement is how to open a video file in full screen automatically(i.e default). Here is my code
<video autoplay loop controls>
<source src="{{videoUrl}}" type="video/mp4">
</video>
<video width="100%" height="100%" autoplay>
<source src="videoUrl" type="video/mp4">
</video>

HTML5 video not playing on safari when I removed muted property

<video poster="video/vr.png" id="bgvid" preload="auto"
playsinline autoplay muted loop >
<source src="video/VR-video.mp4" type="video/mp4">
<source src="video/VR-video.mp4" type="video/mp4">
</video>
When I removed muted attribute video stop playing on safari browser. I want the video to be audible
You cannot remove it programmaticly. It must Be unmuted via a user event like a click.

Audio stops when when background video stops

I have a little problem. I am using video in mp4 as a background(starts at the beginning). I added a audio file that start playing at beginning too and when video is finished audio stops.
<video poster="" id="bgvid" autoplay>
<source src="video/background.mp4" type="video/webm">
<source src="video/background.mp4" type="video/mp4">
</video>
<audio autoplay id="backgroundsound" preload="metadata" loop>
<source src="audio/nuages-dreams.mp3" type="audio/mp3">
Your browser does not support the audio element.
</audio>
HTML5 video tag also add an attribute loop
<video id="bgvid" controls loop>
...
</video>
catching event pause of the video to restart audio :
if($("#bgvid").pause()){
$("#backgroundsound").play();
}
But why are you using audio video separately???
2 files medias to load at the start take mutch resources, you need to integrated the audio with video playing in a timeline you can also stopping display video image and play audio with a loop, with only one media file.

how to change a preview for html5 video?

how to change a preview for html5 video?
I need to show custom image, when user clicks on it video is playing.
<video controls="controls">
<source src="1.webm" type="video/webm">
<source src="1.mp4" type="video/mp4">
</video>
add poster attribut to video tag...
<video controls="controls" poster="url_to_img.jpg">
<source src="1.webm" type="video/webm">
<source src="1.mp4" type="video/mp4">
</video>
to set the preview of the HTML5 video you must know about poster attribute in video tag.
So it should look something like this
<video width=blah height=blah poster=blah >