Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Need help]在ijkoption中添加headers,其中替换了host,不能 #238

Open
316011989 opened this issue Jun 2, 2020 · 1 comment
Open
Labels
help wanted Extra attention is needed wait confirm Waiting for developer confirmation

Comments

@316011989
Copy link

大佬你好
我们公司的m3u8播放链接不想暴漏域名,使用了cdn的ip地址进行播放,并在headers中添加host
现在问题是不能正常播放,因为没有正确的host,播放地址会返回403
下方是具体代码

//尝试添加header到option(host添加到header不可用)
playUrl="http://58.215.151.57/dianshiju/105420/sz01/sz01_720.m3u8?stTime=1591083278&token=6002d5387b145dbbaea9bf4bef922e7f";
var platform = [TargetPlatform.android, TargetPlatform.iOS];

// var options = [IjkOption(IjkOptionCategory.format, "host", header["host"])];
var options = [IjkOption(IjkOptionCategory.format, "headers", header)];
mediaController.setIjkPlayerOptions(platform, options);
await mediaController.setNetworkDataSource(playUrl, autoPlay: true);

我感觉IjkOption使用了headers和host两种方式,都不能真实的把host添加到headers中,导致此问题,请问有没有解决办法

@316011989 316011989 added help wanted Extra attention is needed wait confirm Waiting for developer confirmation labels Jun 2, 2020
@Wisdozzh
Copy link

他里面提供了方法

controller.setNetworkDataSource(url, autoPlay: true, headers: {'host': ' 127.0.0.1'})

但是注意的是,header的value值前面必须添加一个空格才可以
在ijkplayer里面也是相同的解决方案
bilibili/ijkplayer#4946
bilibili/ijkplayer#3693
bilibili/ijkplayer#2648

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed wait confirm Waiting for developer confirmation
Projects
None yet
Development

No branches or pull requests

2 participants