2017-01-05 7 views
0

User-AgentやRefererのようなパラメータが必要なストリーミングHLS(m3u8)を再生しようとしていますが動作しません。Vitamio Androidでヘッダーを設定する

マイコード:

... 

Map<String,String> options = new HashMap<>(); 

options.put("Referer","Xxxxxxxx"); 
options.put("User-Agent","Yyyyyyyy"); 

videoView.setVideoURI(streamURI,options); 

... 

と応答:

D/Vitamio[5.0.1][Player]: [http @ 0x9627e500] HTTP error 403 Forbidden 
E/Vitamio[5.0.1][Player]: avformat_open_input: Server returned 403 Forbidden (access denied) : -858797304 

また、私はこのようにそれを使用しようとしました:結果は同じだった

options.put("headers","Referer:Xxxxxxxx\r\n"); 
options.put("headers","User-Agent:Yyyyyyyy\r\n"); 

...

coにエラーがありますか? de?フォーマット?命令はおそらく?

ありがとうございました。

答えて

0
final HashMap<String, String> options; 

options = new HashMap<>(); 

options.put("headers", "User-Agent: myUserAgent\r\n");

videoView.setVideoURI(Uri.parse("http://www.example.com/playlist.m3u8), options); 

それは正しい方法です。しかし、Userエージェントの解析は標準的な方法とは異なります。あなたはどのサーバを使用していますか?

+0

私はライブラリ=/ – AndrewL6891

+0

を変更したので覚えていません。これはhttps://github.com/Bilibili/ijkplayerにも役立ちます – powerthazan

関連する問題