问题描述
可以在此处找到NanoHttpd服务器代码.
NanoHttpd server code can be found here.
我正在使用NanoHttpd服务器流式传输大型视频(约150mb)的服务中启动一个新线程,但是它只是在显示加载对话框时暂停.我尝试增加和减少缓冲区读取无济于事.服务器似乎无法在Android设备上正常运行.
I'm starting a new Thread in a service that uses NanoHttpd server to stream large videos (about 150mb) but it just pauses right while the loading dialog is shown. I tried increasing and decreasing the buffer reads to no avail. It seems that the server cannot run properly on an Android device.
当我通过桌面应用程序启动服务器时,相同的代码可以正常工作.我可以流超过150mb.通过电话运行服务器时,我只尝试了20mb的文件,它们也很好.但是,我需要提供更多的内容.
Same code works fine when I start the server via desktop application. I can stream more than 150mb. When running the server from the phone, I only tried 20mb files and they were good too. However I need to stream much more than that.
推荐答案
解决了我自己的问题.问题是MediaPlayer(wmp,vlc,android播放器)发出了具有指定RANGE的GET请求.正确地满足了该请求,问题得以解决.
Solved my own problem. The issue is that the MediaPlayer(s) (wmp, vlc, android player), issue a GET request with a specified RANGE. Served that request correctly, problem solved.
这篇关于NanoHttpd服务器无法在Android上流式传输大型视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!