Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
HTML video play file blob object url
<!DOCTYPE html>
<html lang="en">
<meta charset="UTF-8">
<input type="file" name="file" id="fileItem" onchange="onChange()" >
<input type="submit" value="Play">
<script type="text/javascript">
var URL = window.URL || window.webkitURL;
var video = document.getElementsByTagName('video')[0];
function onChange() {
var fileItem = document.getElementById('fileItem');
var files = fileItem.files;
var file = files[0];
var url = URL.createObjectURL(file);
video.src = url;
video.onloadeddata = function() {;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.