javascript - Html5 audio element can't read blob url -
i'm using asp.mvc , recorder.js capture audio view, converting resulting blob url using
url=url.createobjecturl(blop);
then sending url server.
now problem when send url client , try play in audio element src,it gives 404 not found error.
your thoughts please...
edit:
my code goes this:
setinterval(function () { if (canvas) { dataurl = canvas.todataurl(); recorder && recorder.exportwav(handlewav.bind(this)); recorder.clear(); fd = new formdata(); fd.append("audio", audiourl); fd.append("id", id); fd.append("drawing", dataurl); xhr = new xmlhttprequest(); xhr.open("post", "/session/uploaddata", true); xhr.send(fd); } }, 100);
i'm sending canvas drawingurl , audiourl server , them both again in view this
setinterval(function () { if (ctx) { $.ajax({ url: "/session/downloaddata/" + id }) .done(function (data) { x = data; var imageobj = new image(); imageobj.src = data["drawing"]; ctx.drawimage(imageobj, 0, 0); audioelement.src = data["audio"]; //error thrown here audioelement.play(); }); }, 100);
the canvas drawing appears fine, audio doesn't though.
forgot mention error happens after sending url , getting server, works fine if played url directly in page before without it, , yes url comes server same value sent.
function display(vid){ var video = document.getelementbyid("video"); video.src = window.url.createobjecturl(vid); }
Comments
Post a Comment