Cordova Media Plugin not playing local file on iOS -


i'm having problem on playing downloaded audio file local storage using media plugin.

i'm downloading file using filetransfer plugin localfilesystem.temporary directory.

before playing, check existence of audio file using following code:

window.requestfilesystem(localfilesystem.temporary, 0, function (filesystem) {          var rootdir = filesystem.root;          var dir_path = rootdir.tourl();                    if (success_callback) {              if (file_name && file_name !== "") {                  success_callback(dir_path + file_name);              } else {                  success_callback(dir_path);              }          }      }, function () {          if (error_callback) {              error_callback("error in filesystem request");          }      });

the above method verifies file present in temporary storage directory.

but when play file, error following logs on ios:

> file transfer finished response code 200  > audio downloaded successfully. location: file:///var/mobile/containers/data/application/0b5359ad-0f9e-4fb1-beb3-71713973a8a2/tmp/user_timestamp.wav  > play local file from: file:///var/mobile/containers/data/application/0b5359ad-0f9e-4fb1-beb3-71713973a8a2/tmp/user_timestamp.wav  > attempt use file resource localfilesystem.temporary directory  > failed initialize avaudioplayer: operation couldn’t completed. (osstatus error 2003334207.)  > playaudio() error: {"message":"","code":4}

i've tried providing full path , file name media object both approaches don't work. appreciated.

i found out problem. thing ios not playing files recorded on android. plays ios recorded files without problem.

the following link helped me set media plugin files audioplayer.java in android , cdvsound.m in ios similar settings , audios of each platform playing on other.

audio format ios , android


Comments

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -