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

   > You should have a <cordova-project-root>/www directory that contains your 
index.html and other web assets. Cordova copies this entire directory and 
places it in the platform's assets. For android, that would be inside 
/platforms/android/app/src/main/assets/.
   Thank you for this helpful information. It would appear that things in the 
platform_www folder get written to assets\www if present, which is why my 
method was working, but adding them to the root www directory also does appear 
to work, now that I know the platform_www directory isn't where the files are 
finally referenced. There was potentially a phonegap update issue back in the 
day with www that isn't an issue with Android Studio / command line. Even when 
placing assets in the root www folder, however, they still do not transfer to 
the assets\www folder when building in Android Studio; I still have to build 
via command line to make that happen.
   
   > On API 29+ device, writing files to externalRootDirectory should not work
   I am confident that for my Android 12 device (API 31/32), this writes to 
Internal storage, maybe because I don't have an SD card. I have found 
documentation that there is an emulated SD location.
   
   > then the above will attempt to load https://localhost/test.mp3 and this is 
looking for test.mp3 in the read-only assets directory, which wouldn't exist
   Wouldn't `https://localhost/test.mp3` exist if I place it in the root www 
folder and the test.mp3 ends up in assets/www?
   
   > If you want to use the downloaded file, you'll need to get the FileEntry 
object using the file plugin. With the FileEntry you can use .toURL() to get a 
DOM-usable URL. The URL will look something like 
https://localhost/__cdvfile__xxxx/test.mp3. I've mentioned previously about 
limitations with accessing the external storage with the File API, but as long 
as the file is stored within an app directory (e.g. 
/storage/emulated/0/<app-id>/...) then I believe it will still work.
   
   When using the toURL with value for example 
"https://localhost/__cdvfile_files__/A_casa_vete_y_cuenta_alli.mp3"; I get this 
error:
   
   java.net.ConnectException: Failed to connect to localhost/127.0.0.1:443
                                                                                
                        at 
com.android.okhttp.internal.io.RealConnection.connectSocket(RealConnection.java:147)
                                                                                
                        at 
com.android.okhttp.internal.io.RealConnection.connect(RealConnection.java:116)
                                                                                
                        at 
com.android.okhttp.internal.http.StreamAllocation.findConnection(StreamAllocation.java:186)
                                                                                
                        at 
com.android.okhttp.internal.http.StreamAllocation.findHealthyConnection(StreamAllocation.java:128)
                                                                                
                        at 
com.android.okhttp.internal.http.StreamAllocation.newStream(StreamAllocation.java:97)
                                                                                
                        at 
com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:289)
                                                                                
                        at 
com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:232)
                                                                                
                        at 
com.android.okhttp.internal.huc.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:465)
                                                                                
                        at 
com.android.okhttp.internal.huc.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:411)
                                                                                
                        at 
com.android.okhttp.internal.huc.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:542)
                                                                                
                        at 
com.android.okhttp.internal.huc.DelegatingHttpsURLConnection.getResponseCode(DelegatingHttpsURLConnection.java:106)
                                                                                
                        at 
com.android.okhttp.internal.huc.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:30)
                                                                                
                        at 
android.media.MediaHTTPConnection.seekTo(MediaHTTPConnection.java:306)
                                                                                
                        at 
android.media.MediaHTTPConnection.getMIMEType(MediaHTTPConnection.java:499)
                                                                                
                        at 
android.media.IMediaHTTPConnection$Stub.onTransact(IMediaHTTPConnection.java:161)
                                                                                
                        at 
android.os.Binder.execTransactInternal(Binder.java:1220)
                                                                                
                        at android.os.Binder.execTransact(Binder.java:1179)


-- 
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