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

请问如何播放从网络获取的每一帧byte数据 #283

Open
pie-tk opened this issue Jan 14, 2020 · 6 comments
Open

请问如何播放从网络获取的每一帧byte数据 #283

pie-tk opened this issue Jan 14, 2020 · 6 comments

Comments

@pie-tk
Copy link

pie-tk commented Jan 14, 2020

实时从网络获取的byte视频数据,能实时丢给播放器播放吗

@yangchaojiang
Copy link
Owner

什么意思?你的接口请求返回时byte?

@pie-tk
Copy link
Author

pie-tk commented Jan 14, 2020

是的,在一个获取数据的线程中循环获取视频数据,一次获取一帧数据,比如第一帧是I帧,第二帧之后是P帧

@yangchaojiang
Copy link
Owner

需要自己自定义这,DefaultHttpDataSource类。响应中code,修改自己代码
图片
其他代码不用动
然后在 使用自己的数据源类
图片
图片

@pie-tk
Copy link
Author

pie-tk commented Jan 14, 2020

好的,我试试,感谢回复

@pie-tk
Copy link
Author

pie-tk commented Jan 15, 2020

你好,研究了一天没头绪,哈,播放的时候setDataSource和setPlayUri我不理解什么作用,播放的内容肯定是setPlayUri的,如果把setPlayUri去掉就没法播,但我这个没有Uri的,只有视频数据,不知道怎么改写你说的DefaultHttpDataSource才能直接播放buffer,我看到DefaultHttpDataSource中有一个read方法有byte[] buffer,这个是不是可以利用起来?

@yangchaojiang
Copy link
Owner

setPlayUri 链接请求链接。DefaultHttpDataSource是setPlayUri 时内部封装处理

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

2 participants