Created
July 9, 2018 12:53
-
-
Save natp0ng/bb2f9cab145b6105031241de352fc9eb to your computer and use it in GitHub Desktop.
Video test on RPI3 b+
This file contains hidden or 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"> | |
</head> | |
<body> | |
<video class="media-video" height="270" width="480" autoplay loop muted="" controls></video> | |
<script> | |
var videoElem = document.querySelector('.media-video') | |
var blob = null; | |
var xhr = new XMLHttpRequest(); | |
xhr.open("GET", "http://content.bitsontherun.com/videos/bkaovAYt-52qL9xLP.mp4"); | |
xhr.responseType = "blob";//force the HTTP response, response-type header to be blob | |
xhr.onload = function() | |
{ | |
blob = xhr.response;//xhr.response is now a blob object | |
var reader = new FileReader; | |
reader.onload = function() { | |
var blobAsDataUrl = reader.result; | |
// console.log(blobAsDataUrl) | |
videoElem.setAttribute('src', blobAsDataUrl) | |
}; | |
reader.readAsDataURL(blob); | |
} | |
xhr.send(); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment