-
Notifications
You must be signed in to change notification settings - Fork 247
PlayerHttpHeader
wshichang edited this page Feb 21, 2017
·
3 revisions
###播放请求Header设置 针对某些需要对播放请求参数进行修改的场景我们提供了如下方法
public void setDataSource(Context context, Uri uri, Map<String, String> headers)
###使用实例
//设置user-agent
Map<String, String> headers = new HashMap<String, String>();
headers.put("user-agent","demo-user-agent");
//设置Range
headers.put("Range", "bytes=0-10240");
//设置Host
headers.put("Host", "just.demo.host");
ksyMediaPlayer.setDataSource("http://1.1.1.1/test.mp4",headers);
####注意 v1.6.7及之前版本有个bug,需要在value位置加" "空格才会生效,如下所示:
headers.put("user-agent", " demo-user-agent"); //demo-user-agent前面有个空格