breautek commented on issue #401:
URL: 
https://github.com/apache/cordova-plugin-media/issues/401#issuecomment-2418300343

   There's a few things to unpack here, most of which doesn't make much sense:
   
   > 
/storage/emulated/0/Android/data/com.hablamedecristo.himnario2/files/test.mp3
   
   This path suggests that you have your `test.mp3` stored in the 
`cordova.file.dataDirectory` and that your application is installed on an "SD 
Card" (a virtual sd card, not a physical one, hence `/storage/emulated/...`). 
OR you're using `cordova.file.externalApplicationStorageDirectory`. I'm going 
to refer to this as "External" storage here on out.
   
   There are limitations in using external storage through File APIs, though I 
do not think they apply to `externalApplicationStorageDirectory` paths. It's 
worth testing using `cordova.file.dataDirectory` with your app installed on 
android's `Internal` storage to see if that makes a difference.
   
   > Note: when trying to access an mp3 file with 
cordova.file.applicationStorageDirectory 
   
   `applicationStorageDirectory` is suppose to be the app install directory, 
which where your apk is unpacked. This directory itself is suppose to be read 
only. This should point to 
`/storage/emulated/0/Android/data/com.hablamedecristo.himnario2`. 
`cordova.file.dataDirectory` should point to 
`/storage/emulated/0/Android/data/com.hablamedecristo.himnario2/files`.
   
   > I also can download to cordova.file.applicationStorageDirectory via the 
cordova-plugin-file-transfer plugin.
   
   As I stated above, `applicationStorageDirectory` is suppose to be a 
read-only directory, therefore you shouldn't be able to download files to it.
   
   > I get the error "java.net.ConnectException: Failed to connect to 
localhost/127.0.0.1:443"
   
   If you're using the file transfer plugin to "download" from `localhost`, 
you're receiving this error because in this context, `localhost` is the 
`WebViewAssetLoader`, it's only accessible from within the webview itself. The 
file transfer plugin however uses the native network stack, which is external 
of the webview. The file transfer plugin is intended to be used for external 
resources, not to download from the app itself.
   
   > I have test.mp3 saved in the android/platform_www directory.
   
   the `platform_www` directory is something that cordova manages in preparing 
platform-specific web assets. It's not intended for developers to manually add 
content to it. If you want to bundle assets, use `<cordova-project-root>/www` 
directory instead. Manually adding content inside `platform_www` (or anything 
inside the `platforms/` directory in general) is not recommended.
   
   ### Moving forward....
   
   Because there is a lot of weird constructs in the information you've 
provided, we will need a [sample reproduction 
app](https://github.com/apache/cordova-contribute/blob/master/create-reproduction.md)
 that demonstrates the issue. This will help isolate the bug from your 
application code and allows others to easily reproduce the issue. If the issue 
cannot be reproduced in a minimal sample application, then it suggests that the 
bug doesn't rely in the media plugin.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org

Reply via email to