4

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.

hqtay
  • 430
  • 4
  • 13

2 Answers2

1

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

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.

Ken Wolf
  • 23,133
  • 6
  • 63
  • 84
  • Hi, I have a same problem.... I've been smbfile in my project and get it inputstream, and I also inport NanoHttpd to build simple http server, but I dont know how to get "http://localhost/myvideo", Can you teach me or give me a simple code... Thanks a lot!!! – henry4343 Jan 04 '14 at 07:38
  • @henry4343 post a new question with your specific issue and hopefully someone will help you. It's not really possible for me to answer via comments. – Ken Wolf Jan 04 '14 at 08:35
  • Sorry,I cant post question because I get question ban... Can I write Email to you and describe my problem? Thanks – henry4343 Jan 04 '14 at 08:39
  • @henry4343 No! Good luck :) – Ken Wolf Jan 04 '14 at 08:39
  • Thanks for your response... T_T – henry4343 Jan 04 '14 at 08:49
  • http://stackoverflow.com/questions/20929880/android-sdk-samba-server-streaming-video-to-android-using-videoview I already post my question, Can you give me a help... Thanks – henry4343 Jan 06 '14 at 01:12
  • Can you post how you stream the smb share to http? I actually have NanoHTTPD Working and streaming local files to http, and have JCifs listing my files, but i can't find a way to stream those shares over http. – Ivan Verges Oct 16 '14 at 13:37
  • @IvanVerges unfortunately I cannot post the code but here's what I did: I modified `NanoHTTPD.java` so that serveFile took an `SmbFile`. Then instead of using a File object you use the SmbFile object - you have access to the inputstream via `getInputStream()`. Hope that helps a little. – Ken Wolf Oct 16 '14 at 13:56
  • @Ken-Wolf: Actually im handling SmbObjects on a custom class, which gives me Path Lists, InputStream of an SmbObject , and some other things. Also i have FileServer class, which inherits from NanoHTTPD and overrides the serve Method, here i take a Path, InputStream and a MimeType, and Response this. With local files works almos fine (streams nice, but doesn't seek back, just seek forward). Can you tell me the method name on NanoHTTPD to change, because i can't figure out. – Ivan Verges Oct 16 '14 at 16:47
  • 1
    @KenWolf Can you please make a tutorial on this? that would be really helpful. – Karun Shrestha Oct 31 '19 at 13:16
1

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..

Community
  • 1
  • 1
hqtay
  • 430
  • 4
  • 13