Can I use Basic HTTP Authentication with Android MediaPlayer?

前端 未结 5 1220
-上瘾入骨i
-上瘾入骨i 2021-01-24 08:29

I cant find a way to use an url that requires basic auth when im useing mp.setDataSource(url);

MediaPlayer mp = new MediaPlayer();    
mp.setDataSource(url);
mp.         


        
5条回答
  •  时光说笑
    2021-01-24 09:03

    You can pass HTTP headers, including basic auth headers, in MediaPlayer requests using the following method, which is available in Android API level 14 and above.

    http://developer.android.com/reference/android/media/MediaPlayer.html#setDataSource(android.content.Context%2C%20android.net.Uri%2C%20java.util.Map%3Cjava.lang.String%2C%20java.lang.String%3E)

提交回复
热议问题