Stream Audio/Video from computer on Device

walterf25

Expert
Licensed User
Longtime User
Hello all, I just recently started playing with the SMB library, so far i can get all my directories and files from my laptop listed on my phone, Thank you Erel for this great Library.
My question is has anyone done any application where you can stream a video or audio from your pc to your android device, i have been looking at StreamPlayer in the Audio library but i can't figure out how to stream the audio or video from my pc, Is this even possible, i know you can stream something from the web but i can't figure out or maybe is not possible!
If anyone has any suggestions or ideas please do share.

:sign0085:

Thanks All
 

madru

Active Member
Licensed User
Longtime User
simple VLC solution for HLS


or as UDP downstream via ffmpeg/multicast :

ffmpeg -i my_movie.ts -vcodec mpeg2video -pix_fmt yuv420p -me_method epzs -threads 4 -r pal -g 45 -bf 2 -trellis 2 -cmp 2 -subcmp 2 -s 4cif -b 3000k -minrate 3000k -maxrate 3000k -bufsize 1835k -threads 0 -bt 300k -acodec mp2 -ac 2 -ab 192k -ar 44100 -async 1 -metadata service_provider="Some provider" -y -f mpegts udp://239.0.0.1:1234

or via VLC:


--vlc -vvv my_movie.ts sout="#transcode{vcodec=mp2v,vb=3500,fps=25,scal=1,width=768,height=576,cbr, \
acodec=mpga,ab=192,\
vfilter=croppadd{cropleft=0,croptop=2,cropright=0,cropbottom=0}}\
:standard{mux=ts,dst=239.0.0.1:1234,access=udp,sap,name="test"}"
 
Upvote 0

walterf25

Expert
Licensed User
Longtime User
Streaming Audio/Video

Hi Madru thank you for your tips, however i'm not familiar with any of these methods, i'm trying to update an app i have and i would like to incorporate this function in my app, could please elaborate a little more on how i would accomplish this feature with the examples you've provided.

Thank you!
 
Upvote 0

Mark Read

Well-Known Member
Licensed User
Longtime User
Hello Walter,

have you thought about using this: vitamio library for B4A

I wrote a streaming app and it works great on my lg990 and tablet. Its also very fast.

Regards
Mark
 
Upvote 0

Mark Read

Well-Known Member
Licensed User
Longtime User
Hi Walter,

Assuming your PC is on an internal network, then it will have an IP 192.168.x.x or similar. This means it can only be reached internally. I would install a simple web server with PHP support. Using a php file, generate a directory listing of streamable files. Read this html file, parse it and store it in a list. Download each file as required and play it. If you want to stream from outside your network, then you will need some security on the web server but the basic app will be the same. Only your base URL will change:

Internally - Localhost
Externally - Some web address.

My previous link shows how to play a local file. Reading the examples will show you:

B4X:
Example of loading a stream (might be slow in loading due to video-quality such as HD, internet-speed, band-width etc): 
   'vv.LoadVideo("http","http://devimages.apple.com/iphone/samples/bipbop/gear1/prog_index.m3u8") 'this is something from Apple
    'vv.LoadVideo("http","http://rtvgrand.com:8050") 'this is HD - might be extra slow but it looks nice once streaming starts.) http://rtvgrand.com:8050

Where vv is the videoview object from the library.

If you need anymore help. Just ask.

Best Regards.
Mark

The php file to read the directory, I can give you. Its simple but effective.
 
Last edited:
Upvote 0

walterf25

Expert
Licensed User
Longtime User
Streaming Audio/Video

Hi Mark35At, thanks for your help, i actually don't really have any experience setting up a web server, can you please help me on how to do this, you said you could provide me with the php file to list all streamable files, can you provide me with this? I can figure out the rest, I will have to do some research on how to set up an internal website that reads the files from my computer, again thanks for all your help.

Cheers,
Walter
 
Upvote 0

Mark Read

Well-Known Member
Licensed User
Longtime User
Hello Walter,

can you pm me with an email address and I will send you some files: php directory lister and my streaming app.

Sorry if it takes a while, I am working the whole day on PC and don't want to turn on my PC when I get home.

Regards
Mark
 
Upvote 0
Top