Live-Stream Video from One Android Phone to Another Over Wifi

Live-stream video from one android phone to another over WiFi

I did work on something like this once, but sending a video and playing it in real time is a really complex thing. I suggest you work with PNG's only. In my implementation What i did was capture PNGs using the host camera and then sending them over the network to the client, Which will display the image as soon as received and request the next image from the host. Since you are on wifi that communication will be fast enough to get around 8-10 images per-second(approximation only, i worked on Bluetooth). So this will look like a continuous video but with much less effort. For communication you may use UDP sockets(Faster and less complex) or DLNA (Not sure how that works).

Wifi Direct - streaming video from one device to other

Take a look at WIFI-Direct documentation

First you need to establish a connection. there is enough code in the documentation to do that.

Then, then you send the file as a stream and receive it on the other side. Now, based on Android MediaPlayer Documentation you need to send the received stream to the mediaplayer. There are different ways to approach this like saving the stream to a file and then passing the file to the mediaplayer. But a better way is implementing a localhttpserver and passing the local uri to the mediaplayer.

I gathered this info from the links below:

Write to file and stream from it

Modifying FileInputStream for mediaPlayer setDataSource

Android ServerSocket programming with jCIFS streaming files

Create mediaplayer with inputstream in android

Sample Local HTTP server

How can I connect one Android phone to multiple other Android phones, using WiFi direct, with each on a separate channel?

In order to change the channel of the Wifi Direct of your device you need to do the following:
1- Root your phone
2- Download any File manager App: Such as ES File Explorer
3- On ES File Explorer, go to Tools, then turn ON the Root Explorer and click on it then mount RW
4- Using ES File Explorer, go to Device -> Data -> Misc -> Wifi -> p2p_supplicant.conf and change the p2p_oper_channel to whatever channel you want.
5- Turn OFF the Wifi of your phone then turn it ON in order for the change to take place.

You should note that in order for the Wifi direct channel to be the one you did set, the phone needs not to be connected to any Access point when the wifi direct connection starts.
Also, usually when phone A connects to phone B via wifi direct, the connection is operating on phone B's channel.

Hope this helps



Related Topics



Leave a reply



Submit