-
Notifications
You must be signed in to change notification settings - Fork 246
PlayerHttpHeader
xinbaicheng edited this page Feb 21, 2017
·
3 revisions
###播放请求Header设置 在播放以Http协议传输的视频时,有需要对播放的Http请求的Header进行修改,我们提供了如下方法
public void setDataSource(String path, Map<String, String> headers)
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前面有个空格