HTML5 video player which support multiple video resolution sd (standard deviation), HD (high deviation), FHD (full high deviation), UHD (ultra-high deviation) when we click the button it should change the size according to its resolution you also can change video path by giving a name with extension. Save the code as given the suggested name "htmlplayer.html". remember file name extension should be .html or .htm.
Tip:- This code is not converting videos, this is just increasing the length and width of the video, so don't be confused.
HTMLPLAYER.html
<!DOCTYPE html>
<html>
<body>
<div style="text-align:center">
<button onclick="playPause()">Play/Pause</button>
<button onclick="makeBig()">SD</button>
<button onclick="makeSmall()">HD</button>
<button onclick="makeNormal()">FHD</button>
<button onclick="makeNormal1()">UHD</button>
<br><br>
<video id="video1" width="360">
<source src="aa1.mp4" type="video/mp4">
<source src="mov_bbb.ogg" type="video/ogg">
Your browser does not support HTML5 video.
</video>
</div>
<script>
var myVideo = document.getElementById("video1");
function playPause() {
if (myVideo.paused)
myVideo.play();
else
myVideo.pause();
}
function makeBig() {
myVideo.width = 480;
}
function makeSmall() {
myVideo.width = 720;
}
function makeNormal() {
myVideo.width = 1080;
}
function makeNormal1() {
myVideo.width = 2160;
}
</script>
<p>HTML5 Video Player By <a href="http://www.programmingwithbasics.com/" target="_blank">Ghanendra Yadav</a>.</p>
</body>
</html>
Output:-
Video Playing In 360 Px
Video Playing In SD 480 Px
Video Playing In HD 720 Px
Video Playing In FHD 1080 Px
Video Playing In UHD 2160 Px
HTMLPLAYER.html
<!DOCTYPE html>
<html>
<body>
<div style="text-align:center">
<button onclick="playPause()">Play/Pause</button>
<button onclick="makeBig()">SD</button>
<button onclick="makeSmall()">HD</button>
<button onclick="makeNormal()">FHD</button>
<button onclick="makeNormal1()">UHD</button>
<br><br>
<video id="video1" width="360">
<source src="aa1.mp4" type="video/mp4">
<source src="mov_bbb.ogg" type="video/ogg">
Your browser does not support HTML5 video.
</video>
</div>
<script>
var myVideo = document.getElementById("video1");
function playPause() {
if (myVideo.paused)
myVideo.play();
else
myVideo.pause();
}
function makeBig() {
myVideo.width = 480;
}
function makeSmall() {
myVideo.width = 720;
}
function makeNormal() {
myVideo.width = 1080;
}
function makeNormal1() {
myVideo.width = 2160;
}
</script>
<p>HTML5 Video Player By <a href="http://www.programmingwithbasics.com/" target="_blank">Ghanendra Yadav</a>.</p>
</body>
</html>
Output:-
Video Playing In 360 Px
0 Comments: