You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by GitBox <gi...@apache.org> on 2022/06/15 19:47:49 UTC

[GitHub] [cordova-plugin-media] pvandrunen opened a new issue, #346: In Android include webView cookies for streaming in setDataSource()

pvandrunen opened a new issue, #346:
URL: https://github.com/apache/cordova-plugin-media/issues/346

   # Feature Request
   
   ## Motivation Behind Feature
   <!-- Why should this feature be implemented? What problem does it solve? -->
   On Android I am unable to stream mp3 files that require authentication header to access. 
   
   I've set this as a feature because it looks like it was never intentionally implemented, HOWEVER, it might be a bug if other users are not experiencing this problem.
   
   Note: I am using Capacitor.
   
   
   ## Feature Description
   <!-- 
   Describe your feature request in detail
   Please provide any code examples or screenshots of what this feature would look like
   Are there any drawbacks? Will this break anything for existing users? 
   -->
   The media.create function would include an additional boolean parameter to indicate whether the streaming file should include headers, or an array of headers to include.
   
   AFAICT this is only a problem on Android. I'm surprised that this doesn't work or hasn't been implemented so maybe I'm doing something wrong:
   
   Using the cordova-plugin-filetransfer I am able to download files that require authentication. When I look at the Java code I see there is a function that pulls the cookie's from webview and includes them in the header with the file request.
   
   When I look at the Java code for cordova-plugin-media I see this, which does not include any headers
   `        if (this.isStreaming(file)) {
               this.player.setDataSource(file);`
   
   And looking at the API for setDataSource, it looks like I can include the headers. But it also says that they might already be managed by the apps own CookieManager.
   https://developer.android.com/reference/android/media/MediaPlayer#setDataSource(android.content.Context,%20android.net.Uri,%20java.util.Map%3Cjava.lang.String,%20java.lang.String%3E,%20java.util.List%3Cjava.net.HttpCookie%3E)
   
   ## Alternatives or Workarounds
   <!-- 
   Describe alternatives or workarounds you are currently using 
   Are there ways to do this with existing functionality?
   -->
   - I am able to playback files that do not require authentication. 
   - I am able to download with fileTransfer files that require authentication. 
   - I could download the files before playing them back. But that's not a great experience. 
   - I could also add an endpoint to the API to create a token for the file url to authenticate that way, but that would be fairly involved as well.
   
   


-- 
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-unsubscribe@cordova.apache.org.apache.org

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


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