How to stream video across LAN in android VideoView

风格不统一 提交于 2019-12-04 13:41:48

问题


Due to office constraints I have a LAN network without internet and have to stream a video into my android application.

I can view the video in ES Explorer on the device through smb ok. But what's the best way to get it to play in my VideoView app? using "smb://192.168.x.x/Users/Public/.." as the URI doesn't work.

Thanks.


回答1:


I've been able to play smb:// shares over the network in a VideoView by:

  • Using JCIFS to scan for and "see" the share: http://jcifs.samba.org/

  • Implementing a simple HTTP server (NanoHttpd) to stream the content via http: https://github.com/NanoHttpd/nanohttpd

  • Passing the http://localhost/myvideo link to the VideoView

I realise this seems convoluted (and I agree) but it's the only way I've managed to get it working (and working well, with seeking, etc.). I'd be interested if there are better solutions.




回答2:


I've found out that one (cheapo) way is just install VLC media player and stream the video from the PC there, following the instructions android-video-streaming-example.

So in the android activity it looks something like:

myVideoView.setVideoURI(Uri.parse("rtsp://192.168.2.3:5544/"));

Works on my app now, but the lag is terrible (5+ sec), so yup the question's still open for better answers, while I'll experiment with other stuff..



来源:https://stackoverflow.com/questions/17442941/how-to-stream-video-across-lan-in-android-videoview

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!