javascript - Passing createObjectURL -
i want pass address created window.url.createobjecturl(file)
dancer.js get blob:http%3a//localhost/b847c5cd-aaa7-4ce0-8ff8-c13c6fc3505a.mp3 404 (not found)
.
i manage create sound element file selected through file input, dancer.js not find file... ideas? (below how pass objecturl)
$(document).ready(function(){ $("#submit").click(function(){ var file = document.getelementbyid("file").files[0]; $('body').append('<audio id="audio" controls="controls"></audio>'); $('#audio').append('<source src='+window.url.createobjecturl(file)+' type=audio/mpeg />') $('body').append('<a href='+window.url.createobjecturl(file)+'>link</a>') dancer(window.url.createobjecturl(file)); }) })
looking @ dancer.js readme looks load
method take either reference <audio>
element or configuration object specifies source: {scr: varholdingfileurl}
. since creating <audio>
element file i'd pass dancer:
$(document).ready(function() { var dancer = new dancer(), fileurl; $("#submit").click(function(){ var audioelement, file = document.getelementbyid("file").files[0]; fileurl = window.url.createobjecturl(file); // remove preexisting instances of sound tag $('#audio').remove(); // revoke used file url doesn't // take memory anymore. window.url.revokeobjecturl(fileurl); $('body').append('<audio id="audio" controls="controls"></audio>'); $('#audio').append('<source src='+ fileurl +' type=audio/mpeg />') $('body').append('<a href=' + fileurl +'>link</a>') // reference sound element created audioelement = $('#audio')[0]; dancer.load(audioelement); }) });
javascript url audio fileapi
No comments:
Post a Comment