-
-
Save gormus/99f1c582b7cb4945ae14f879cd0093f6 to your computer and use it in GitHub Desktop.
JS Bin // source https://jsbin.com/qovime
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> | |
<link href="https://cdnjs.cloudflare.com/ajax/libs/foundation/5.5.2/css/normalize.min.css" rel="stylesheet" type="text/css" /> | |
<link href="https://cdnjs.cloudflare.com/ajax/libs/foundation/5.5.2/css/foundation.min.css" rel="stylesheet" type="text/css" /> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/foundation/5.5.2/js/vendor/modernizr.js"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/foundation/5.5.2/js/vendor/jquery.js"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/foundation/5.5.2/js/foundation.min.js"></script> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
<style id="jsbin-css"> | |
#a { | |
max-width: 500px; | |
margin: 0 auto; | |
} | |
</style> | |
</head> | |
<body> | |
<div id="a"> | |
<div class="row"> | |
<div class="small-12"> | |
<div class="flex-video"> | |
<video controls id="video-bg"></video> | |
</div> | |
</div> | |
</div> | |
</div> | |
<script id="jsbin-javascript"> | |
getBlobURL("https://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4", "video/mp4", function(url, blob) { | |
var source = $("<source>"); | |
source[0].src = url; | |
$("#video-bg").append(source); | |
}); | |
function getBlobURL(url, mime, callback) { | |
var xhr = new XMLHttpRequest(); | |
xhr.open("get", url); | |
xhr.setRequestHeader('Access-Control-Allow-Origin', '*'); | |
xhr.setRequestHeader('Access-Control-Allow-Methods', 'GET'); | |
xhr.responseType = "arraybuffer"; | |
xhr.addEventListener("load", function() { | |
var arrayBufferView = new Uint8Array( this.response ); | |
var blob = new Blob( [ arrayBufferView ], { type: mime } ); | |
var url = null; | |
if ( window.webkitURL ) { | |
url = window.webkitURL.createObjectURL(blob); | |
} else if ( window.URL && window.URL.createObjectURL ) { | |
url = window.URL.createObjectURL(blob); | |
} | |
callback(url, blob); | |
}); | |
xhr.send(); | |
} | |
</script> | |
<script id="jsbin-source-css" type="text/css">#a | |
max-width: 500px | |
margin: 0 auto</script> | |
<script id="jsbin-source-javascript" type="text/javascript">getBlobURL("https://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4", "video/mp4", function(url, blob) { | |
var source = $("<source>"); | |
source[0].src = url; | |
$("#video-bg").append(source); | |
}); | |
function getBlobURL(url, mime, callback) { | |
var xhr = new XMLHttpRequest(); | |
xhr.open("get", url); | |
xhr.setRequestHeader('Access-Control-Allow-Origin', '*'); | |
xhr.setRequestHeader('Access-Control-Allow-Methods', 'GET'); | |
xhr.responseType = "arraybuffer"; | |
xhr.addEventListener("load", function() { | |
var arrayBufferView = new Uint8Array( this.response ); | |
var blob = new Blob( [ arrayBufferView ], { type: mime } ); | |
var url = null; | |
if ( window.webkitURL ) { | |
url = window.webkitURL.createObjectURL(blob); | |
} else if ( window.URL && window.URL.createObjectURL ) { | |
url = window.URL.createObjectURL(blob); | |
} | |
callback(url, blob); | |
}); | |
xhr.send(); | |
}</script></body> | |
</html> |
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
#a { | |
max-width: 500px; | |
margin: 0 auto; | |
} |
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
getBlobURL("https://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4", "video/mp4", function(url, blob) { | |
var source = $("<source>"); | |
source[0].src = url; | |
$("#video-bg").append(source); | |
}); | |
function getBlobURL(url, mime, callback) { | |
var xhr = new XMLHttpRequest(); | |
xhr.open("get", url); | |
xhr.setRequestHeader('Access-Control-Allow-Origin', '*'); | |
xhr.setRequestHeader('Access-Control-Allow-Methods', 'GET'); | |
xhr.responseType = "arraybuffer"; | |
xhr.addEventListener("load", function() { | |
var arrayBufferView = new Uint8Array( this.response ); | |
var blob = new Blob( [ arrayBufferView ], { type: mime } ); | |
var url = null; | |
if ( window.webkitURL ) { | |
url = window.webkitURL.createObjectURL(blob); | |
} else if ( window.URL && window.URL.createObjectURL ) { | |
url = window.URL.createObjectURL(blob); | |
} | |
callback(url, blob); | |
}); | |
xhr.send(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment