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

本地运行demo报错,无法播放flv文件 #65

Closed
zhuyimiao opened this issue Dec 22, 2016 · 27 comments
Closed

本地运行demo报错,无法播放flv文件 #65

zhuyimiao opened this issue Dec 22, 2016 · 27 comments

Comments

@zhuyimiao
Copy link

zhuyimiao commented Dec 22, 2016

var mediaDataSource = {"type":"flv","url":"vedio2.flv"};

同目录下放了个vedio2.flv 的文件,运行demo里的index.html,
浏览器报错:
index.html:1 Not allowed to load local resource: blob:null/f50df6a4-3cd2-4297-8903-95a6ceef65f7

作者大大,这是什么原因?需要怎么改?同样的方法,播放mp4文件就可以

使用README.md里给的代码:
if (flvjs.isSupported()) {
var videoElement = document.getElementById('videoElement');
var flvPlayer = flvjs.createPlayer({
type: 'flv',
url: 'http://example.com/flv/video.flv'
});
flvPlayer.attachMediaElement(videoElement);
flvPlayer.load();
flvPlayer.play();
}

也是报同样的错误

@zhuyimiao
Copy link
Author

我是直接在浏览器里打开了index.html文件

@Riricho
Copy link

Riricho commented Dec 22, 2016

Not allowed to load local resource似乎是因为chrome的安全限制禁止这样加载本地资源。
我在edge里打开就不报这个错了,但遇到了新问题:
[IOController] > Loader error, code = -1, msg = ProgressEvent error
[TransmuxingController] > IOException: type = Exception, code = -1, msg = ProgressEvent error
检查过flv地址 但并没有发现错误(╯‵□′)╯︵┻━┻

@Riricho
Copy link

Riricho commented Dec 22, 2016

刚刚开了apache试了试,chrome和edge都可以顺利播放了。
你可以尝试在web service里用127.0.0.1运行下页面试试╰(°▽°)╯

@cyfour
Copy link

cyfour commented Dec 23, 2016

用Apache 也是报错[MSEController] > MediaSource onSourceOpen
2flv.min.js:3 GET http://example.com/flv/video.flv value @ flv.min.js:3value @ flv.min.js:3value @ flv.min.js:2value @ flv.min.js:2value @ flv.min.js:1value @ flv.min.js:4(anonymous function) @ flv.min.js:4i.emit @ flv.min.js:1value @ flv.min.js:1
(index):1 Fetch API cannot load http://example.com/flv/video.flv. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://127.0.0.1:8080' is therefore not allowed access. The response had HTTP status code 500. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
flv.min.js:5 [IOController] > Loader error, code = -1, msg = Failed to fetchvalue @ flv.min.js:5value @ flv.min.js:3(anonymous function) @ flv.min.js:3
flv.min.js:5 [TransmuxingController] > IOException: type = Exception, code = -1, msg = Failed to fetchvalue @ flv.min.js:5value @ flv.min.js:2value @ flv.min.js:3(anonymous function) @ flv.min.js:3
flv.min.js:1 Uncaught (in promise) Error: Uncaught, unspecified "error" event. (NetworkError)(…)

@Riricho
Copy link

Riricho commented Dec 23, 2016

@cyfour
你需要把url: 'http://example.com/flv/video.flv' 这里的地址换成一个有效的flv地址
我是直接去bilibili下了一段flv放在本地里加载的
所以我这里的代码是url: 'flv/video.flv'
我的目录结构是:
--js
--css
--flv
----index.html

完整的代码是:
`

<title>flvJs demo</title>
<script type="text/javascript" src="js/flv.js"></script> <script> if (flvjs.isSupported()) { var videoElement = document.getElementById('videoElement'); var flvPlayer = flvjs.createPlayer({ type: 'flv', url: 'flv/video.flv' }); flvPlayer.attachMediaElement(videoElement); flvPlayer.load(); flvPlayer.play(); } </script> ` 你可以参考下 移动端的meta可以直接无视╰(*°▽°*)╯

@cyfour
Copy link

cyfour commented Dec 23, 2016

改了本地的 Uncaught (in promise) Error: Uncaught, unspecified "error" event. (MediaError)(…)
flv.min.js:1 Uncaught (in promise) Error: Uncaught, unspecified "error" event. (MediaError)(…) 一直报这个错。。。

@cyfour
Copy link

cyfour commented Dec 23, 2016

换了另外的FLV 又出现不同的报错 [FLVDemuxer] > Parsed onMetaData
2flv.min.js:5 [TransmuxingController] > DemuxException: type = CodecUnsupported, info = Flv: Unsupported audio codec idx: 2value @ flv.min.js:5value @ flv.min.js:2value @ flv.min.js:2value @ flv.min.js:2value @ flv.min.js:2value @ flv.min.js:3value @ flv.min.js:3(anonymous function) @ flv.min.js:3
flv.min.js:5 [TransmuxingController] > DemuxException: type = CodecUnsupported, info = Flv: Unsupported codec in video frame: 4value @ flv.min.js:5value @ flv.min.js:2value @ flv.min.js:2value @ flv.min.js:2value @ flv.min.js:2value @ flv.min.js:3value @ flv.min.js:3(anonymous function) @ flv.min.js:3
flv.min.js:5 [TransmuxingController] > DemuxException: type = CodecUnsupported, info = Flv: Unsupported audio codec idx: 2value @ flv.min.js:5value @ flv.min.js:2value @ flv.min.js:2value @ flv.min.js:2value @ flv.min.js:2value @ flv.min.js:3value @ flv.min.js:3(anonymous function) @ flv.min.js:3
flv.min.js:5 [TransmuxingController] > DemuxException: type = CodecUnsupported, info = Flv: Unsupported codec in video frame: 4value @ flv.min.js:5value @ flv.min.js:2value @ flv.min.js:2value @ flv.min.js:2value @ flv.min.js:2value @ flv.min.js:3value @ flv.min.js:3(anonymous function) @ flv.min.js:3
7flv.min.js:5 [TransmuxingController] > DemuxException: type = CodecUnsupported, info = Flv: Unsupported audio codec idx: 2value @ flv.min.js:5value @ flv.min.js:2value @ flv.min.js:2value @ flv.min.js:2value @ flv.min.js:2value @ flv.min.js:3value @ flv.min.js:3(anonymous function) @ flv.min.js:3
flv.min.js:5 [TransmuxingController] > DemuxException: type = CodecUnsupported, info = Flv: Unsupported codec in video frame: 4

@kore-tao
Copy link

哪里有flv.min.js?

@shunzizhan
Copy link

我现在也是各种报错,本地跑,也是提示错误
image
使用线上的flv文件,则提示跨域,让运维配nginx转跳,还是报错
image

哪位用完好的demo,能不能发我一份?

@xqq
Copy link
Contributor

xqq commented Dec 26, 2016

仅支持H264+AAC

@shunzizhan
Copy link

1.我不是很明白你的意思 @xqq 仅支持H264+AAC
2.我目前需要在移动端播放视频,需要同时兼容Android和ios版本,flv.js能不能够支持?

@xqq
Copy link
Contributor

xqq commented Dec 26, 2016

  1. 从错误logcat看,输入文件是不受支持的H263+MP3编码。
  2. Android 支持,ios 不支持

@cyfour
Copy link

cyfour commented Dec 27, 2016

求一个 H264+AAC 的FLV 我这边只能用格式工厂转化成H264+AAC 的MP4。

@Riricho
Copy link

Riricho commented Dec 27, 2016

@cyfour
你可以直接去B站上抓一段flv下来测试 B站的视频都是一段一段的flv拼起来的

@cyfour
Copy link

cyfour commented Dec 27, 2016

flv.min.js:5 [TransmuxingController] > DemuxException: type = CodecUnsupported, info = Flv: Unsupported codec in video frame: 2谷歌提示这个 360浏览器可以播放

@Riricho
Copy link

Riricho commented Dec 27, 2016

@shunzizhan
我邮件发了一份我的demo给你了,PC和IOS上测试是没问题的,安卓因为没有安卓机暂时还没测试过_(:з)∠)_

@cyfour
Copy link

cyfour commented Dec 27, 2016

@Riricho 也发一份给我哈~谢谢。

@Riricho
Copy link

Riricho commented Dec 27, 2016

@cyfour 我没找到你邮箱_(:з)∠)_
完整的Demo我直接丢在我服务器上了,需要的可以去自取。
http://www.riricho.com/flvJs.zip
放在web service环境下等页面加载完 点击下面的load才会加载视频资源
Start和Pause是播放和暂停,seekTo有bug不要点_(:з)∠)_

@tianyw0
Copy link

tianyw0 commented Feb 8, 2017

sigh

@tenglongwentian
Copy link

@Riricho 请问ios您是选择的测试版本是什么,我这里用ipad air测试失败,无法播放

@xqq
Copy link
Contributor

xqq commented Mar 8, 2017

不支持ios

@xqq xqq closed this as completed Mar 8, 2017
@Riricho
Copy link

Riricho commented Mar 8, 2017

@tenglongwentian 5s/ios10/safari.

@tenglongwentian
Copy link

2017年3月8日测试,chrome内核浏览器,奇数版本号不支持,偶数版本号支持,Android端;网上搜索称:奇数版本号是beta版,偶数版本号是stable版 @Riricho ,目前正在寻求IOS能够播放之道

@VIRGIL-YAN
Copy link

@Riricho 能不能也发我一份

@opewwe
Copy link

opewwe commented Aug 9, 2022

@shunzizhan 我邮件发了一份我的demo给你了,PC和IOS上测试是没问题的,安卓因为没有安卓机暂时还没测试过_(:з)∠)大佬能发给我一份吗 最近在做flv的项目 本地一直报错

@wangxiaohuiboy
Copy link

我现在也是报各种错误,本地跑,也是提示错误 使用线上的flv文件,则提示跨域,让运维配nginx转跳,还是报错 图片 图片

哪位用发我的demo,能不能?

请问大佬,你这个问题解决了吗

@wei13030206499
Copy link

大佬,我也遇到这个问题,有办法解决吗

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests