@distante wrote:
I use audio files in my app that I need to get as an buffer array. For this I let the user choose a file (using Ionic/Cordova FileChooser Plugin) and then I get an URL like:
content://com.android.providers.media.documents/document/audio%3A8431After that, I sent this to Cordova Plugin File
resolveNativePathfunction and I get a Path Like:file:///storage/emulated/0/Prueba interno/Interno, Teddybär, Dreh Dich Um__320kbps.mp3Here I make my
audioFileInfoObjectaudioFileInfo = {name: "Interno, Teddybär, Dreh Dich Um__320kbps.mp3", originalPath: "content://com.android.providers.media.documents/document/audio%3A8431", path: "file:///storage/emulated/0/Prueba interno"}and finally I call
filePlugin.readAsArrayBuffer(audioFileInfo.path, audioFileInfo.name)to get the buffer array.It works ok when the file is in the device internal storage, but when the file comes from the SDCard it does not work because the
readAsArrayBufferreturns “not found”.SD Card:
File Chooser URL
content://com.android.externalstorage.documents/document/3D91-1C14%3AM%C3%BAsica%20Dana%2F1%20-%20Teddyb%C3%A4r%2C%20Teddyb%C3%A4r%2C%20Dreh%20Dich%20Um__320kbps.mp3resolveNativePath:
file:///sdcard/Música Dana/1 - Teddybär, Teddybär, Dreh Dich Um__320kbps.mp3audioFileInfo:
audioFileInfo = { name :"1 - Teddybär, Teddybär, Dreh Dich Um__320kbps.mp3" originalPath : "content://com.android.externalstorage.documents/document/3D91-1C14%3AM%C3%BAsica%20Dana%2F1%20-%20Teddyb%C3%A4r%2C%20Teddyb%C3%A4r%2C%20Dreh%20Dich%20Um__320kbps.mp3", path : "file:///sdcard/Música Dana" }readAsArrayBuffer:
FileError {code: 1, message: "NOT_FOUND_ERR"}I have tried FilePlugins’s
resolveLocalFilesystemUrl()and I get thisEntryobject:{ filesystem: { name: "content", root: { filesystem { name: "content", root: "...." } }, fullPath: "/", isDirectory: true, isFile: false, name: "", nativeURL: "content://", }, fullPath: "/com.android.externalstorage.documents/document/3D91-1C14:Música Dana/1 - Teddybär, Teddybär, Dreh Dich Um__320kbps.mp3", isDirectory: false, isFile: true, name: "1 - Teddybär, Teddybär, Dreh Dich Um__320kbps.mp3", nativeURL: "content://com.android.externalstorage.documents/document/3D91-1C14%3AM%C3%BAsica%20Dana%2F1%20-%20Teddyb%C3%A4r%2C%20Teddyb%C3%A4r%2C%20Dreh%20Dich%20Um__320kbps.mp3", }Bue I have no idea what to use as
pathin the first parameter of thereadAsArrayBufferfunction.If I use
fullPathandnameit throws encoding error.
If I get just the “path” without the name fromfullPath, it also throws encoding error.Does anybody had a similar experience?
Posts: 1
Participants: 1