browser - Play a loaded file in javascript -


i'm trying load file user , want play javascript.

the file loaded correctly, , can access seeing name, type , on, filelist api.

what can't play obtained file. tried do

myfile.play(); 

like loaded file, doesn't work.

any idea?

if want play media content, instead of using filereader, suggest use createobjecturl method. more efficient since not create string containing file content.

https://developer.mozilla.org/fr/docs/dom/window.url.createobjecturl

just :

audio/video.src=window.url.createobjecturl(myfile); 

don"t forget revoke uri when loading media file avoid memory leaks :

window.url.revokeobjecturl(audio/video.src); 

Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -