Last active
July 1, 2024 18:17
-
-
Save SalvadorP/8ad13514004209165706 to your computer and use it in GitHub Desktop.
Simple HTML 5 video player on demand, just paste the video URL and it will begin to play
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>Simple HTML5 Video Player</title> | |
</head> | |
<body> | |
<script src="https://code.jquery.com/jquery-2.1.4.min.js"></script> | |
<div> | |
Video URL: <input type="text" id="videoUrl" name="videoUrl"> | |
</div> | |
<br /> | |
<div> | |
<video width="640" height="480" id="video" controls> | |
<source src="" type="video/mp4"> | |
Your browser does not support the video tag. | |
</video> | |
</div> | |
<script type="text/javascript"> | |
$( document ).ready(function() { | |
$('#videoUrl').on('change', function(e) { | |
var video = $('#video'); | |
video.children('source').attr('src', $(this).val()); | |
video[0].load(); | |
video[0].play(); | |
}); | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment