android - apache cordova set/get audio name/path from storage -


i want able save name , path of recorded audio file, these values next time start app. believe can save them this, local storage:

// after recording done function capturesuccess(mediafile) {   addfilepath(mediafile); }  function addfilepath(mediafile) {     localstorage.setitem(mediafile.name, mediafile.fullpath); } 

how can these values next time start app? there better way store these values?

in way, when try path of audio file next time can not know key 'mediafile.name'.

in application, created object contains file's informations, stored in localstorage using constant key 'audio'. following example illustrates how that:

var filename = "audiofilename"; var filepath = "audiofilepath";  localstorage.myaudio = { name: filename, path: filepath };   // file's informations in next time var audio = localstorage.myaudio;  var filename = audio.name; var filepath = audio.path; 

if want store more 1 file :

// stored array in localstorage audiofiles = localstorage.myaudio ? json.parse(localstorage.myaudio) : [];  // add new audio array var filename = "audiofilename"; var filepath = "audiofilepath"; audiofiles.push({ name: filename, path: filepath });  // store array in localstorage localstorage.myaudio = json.stringify(audiofiles); 

Comments

Popular posts from this blog

dns - How To Use Custom Nameserver On Free Cloudflare? -

python - Pygame screen.blit not working -

c# - Web API response xml language -