Is it possible to play video by somehow passing data from a File object into a <video>
tag?
I know you can base64 encode things to put include the data in the DOM, but I understand there are size limits on this, so can anyone think of another way, or a workaround for this?
For now it's just a bit of an experiment, so lets not worry too much about video file formats... just assume that the format works with the browser you're using.
Is it possible to play video by somehow passing data from a File object into a <video>
tag?
I know you can base64 encode things to put include the data in the DOM, but I understand there are size limits on this, so can anyone think of another way, or a workaround for this?
For now it's just a bit of an experiment, so lets not worry too much about video file formats... just assume that the format works with the browser you're using.
Share Improve this question asked Mar 21, 2012 at 10:14 NathanNathan 11.2k4 gold badges40 silver badges50 bronze badges1 Answer
Reset to default 6URL.createObjectURL
will create urls that link to the files, otherwise you will just crash your browser.
var URL = window.URL || window.webkitURL;
var src = URL.createObjectURL( file );
videoElem.src = src;
The urls will use blob scheme, example:
"blob:http%3A%2F%2Fstackoverflow./c04ac1f0-cd88-4587-9905-741b90c62684"
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745614393a4636143.html
评论列表(0条)