开发者

How to change default User-agent in mediaplayer of the android [duplicate]

开发者 https://www.devze.com 2023-02-12 12:17 出处:网络
This question already has answers here: Changing Android's default MediaPlayer User-Agent string 开发者_JAVA技巧
This question already has answers here: Changing Android's default MediaPlayer User-Agent string 开发者_JAVA技巧 (2 answers) Closed 7 years ago.

In which file of the android repo do i have to change the default user-agent? I need to set this string as default user-agent for the media-player: HTC Streaming Player vodafone_uk / 1.0 / htc_bravo / 2.2


public void setDataSource (Context context, Uri uri, Map<String, String> headers);

In you app which controls MediaPlayer instance, pass the user agent in the header map as follows:

Map<String, String> headerMap = new HashMap<String, String>();;
headerMap.put("User-Agent", "my user agent value");
mediaPlayer.setDataSource(context, uri, headerMap);
0

精彩评论

暂无评论...
验证码 换一张
取 消