I'm currently building a site that lets users play local video files in the browser - just like VLC desktop, except in the browser.
I'm trying to simplify the action of adding files to the playlist - I am currently able to launch a movie from a text input (--> users writes the local file's path in the input field), but would very much like to be able to do so from a file input (<input type="file"> --> a much more natural way to go for the average user I think).
For security purposes, no browser will let me access the full path of a file selected via an file input. However, HTML5's File API will let me create an ObjectURL that points to the local file:
Code: Select all
file = $('#fileInput').get(0).files[0];
window.URL = window.webkitURL || window.URL;
var fileURL = window.URL.createObjectURL(file);
Code: Select all
blob:http://localhost:6564/02dc860b-b77e-4c40-b62b-39096f9672b6