I have a problem. When I add new element to my bullet list:
<input id="wejscie" type="file" accept="video/*"/>
<ol id="playlist">
<li movieurl="http://html5videoformatconverter.com/data/images/happyfit2.mp4">Happy Fit</li>
<li movieurl="http://grochtdreis.de/fuer-jsfiddle/video/sintel_trailer-480.mp4">Sintel</li>
<li movieurl="http://html5example.net/static/video/html5_Video_VP8.webm">Resident Evil</li>
<li movieurl="http://www.ioncannon.net/examples/vp8-webm/big_buck_bunny_480p.webm">Big Buck Bunny</li>
</ol>
with this function:
$(function() {
$("#wejscie").on("change", function() {
var URL = window.URL || window.webkitURL
var file = this.files[0];
var fileURL = URL.createObjectURL(file);
var fileName = '';
function getName(s) {
return s.replace(/^.*[\\\/]/, '');
}
fileName = getName(fileURL);
$("ol").append('<li movieurl="' + fileURL + '">' + fileName + '</li>');
});
});
when I switch video to one from default and back to added it will not play. To play video I use this function:
$(function() {
$("#playlist li").on("click", function() {
$("#videoarea").attr({
"src": $(this).attr("movieurl"),
"poster": "",
"autoplay": "autoplay"
});
});
$("#videoarea").attr({
"src": $("#playlist li").eq(0).attr("movieurl"),
"poster": $("#playlist li").eq(0).attr("moviesposter")
});
});
Also my fileName is just bunch of random letters and numbers. Can You tell me what am I doing wrong?