我正在尝试创建一个意图,该意图将调用mxplayer intent
和vlc player
意图。该意图将包含实时视频链接和用户代理。我使用intent.setData()
添加了网址,但如何添加user agent header
? 代码:
String packagename = "com.mxtech.videoplayer.ad";
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setPackage(packagename);
intent.setData(Uri.parse(now.video_url));
//add the user agent header here
// now.user_agent contains the agent link
context.startActivity(intent);
还有如何在vlc播放器中执行此操作,我在用户代理的android-api中没有找到任何内容 我对vlc的尝试:
String packagename = "org.videolan.vlc";
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setPackage(packagename);
intent.setData(Uri.parse(now.video_url));
intent.putExtra("user-agent",now.user_agent);
//tried these too , doesn't work
//intent.putExtra("http-user-agent",now.user_agent);
//intent.putExtra("User-Agent",now.user_agent);
//String[] headers = {
// "http-user-agent", now.user_agent
// };
//intent.putExtra("headers",headers);
context.startActivity(intent);
[通过查看他们的API,我添加了它,然后就可以了
String[] headers = {
"User-Agent", now.user_agent
};
intent.putExtra("headers",headers);
context.startActivity(intent);
到目前为止没有找到VLC的任何内容>