12

I need to create an android app to display a live TV feed. the app is supposed to play live video streams from a Multicast of a DVB gateway, according to the gateway vendor it can stream out UDP or RTP. I set up vlc on my computer to stream out UDP and RTP and broke my fingers trying to get the android player to show them. after a while I found out that android only supports HTTP/S and RTSP live streams. I tried all the FFMPEG solutions and different media players with no success yet. I am not a video expert but to my understanding RTSP is an encapsulation of RTP, can my RTP feed be wrapped and streamed (even via proxy) ? does anyone know of a working UDP solution ?

thanks

I started writing a tunnel that passes a local UDP stream from port 1234, to a TCP connection on port 8888. I am testing with VLC, the UDP payload looks correct, and I am able to see the VLC init the http connection when I wait for the TCP listener to accept the connection. but still VLC wont play the resulting HTTP stream, my code:

public void Bridge()
    {
        //endpoints
        IPEndPoint myRemoteEndpoint = new IPEndPoint(IPAddress.Parse("127.0.0.1"), 1234);

        //communications objects
        UdpClient myUdpClient = new UdpClient(myRemoteEndpoint);
        TcpListener myTcpListener = new TcpListener(IPAddress.Any, 8888);

        //buffer
        byte[] buffer = new byte[2048];

        //start tcp listener
        myTcpListener.Start();
        Socket tcpAcceptedSocket = myTcpListener.AcceptSocket();            

        while (true)
        {
            try
            {
                //get data from UDP client
                buffer = myUdpClient.Receive(ref myRemoteEndpoint);

                //send bytes received from UDP over TCP
                tcpAcceptedSocket.Send(buffer);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }

        //close sockets
        myUdpClient.Close();
        myTcpListener.Stop();

    }

any thoughts ?

Omriko
  • 363
  • 1
  • 6
  • 14

1 Answers1

2

Hopefully you've solved this already?

My first thought was "how do you exit that while (true) loop?" lol

RTP was added to the Android SDK in API level 12:

http://developer.android.com/reference/android/net/rtp/package-summary.html

Perhaps you can use android.net.rtp to catch your streaming video. There seems to be a significant lack of tutorials in this area, so if you did/do get this working I'm sure a quick write-up could fly up the big G search results; not to mention helping out the posters of 600+ other questions on stackoverflow that come up in an "android udp rtp" search.

From the blog-o-sphere:

http://burcudogan.com/2011/06/05/android-rtp-implementation-is-based-on-udp/

And I'll toss in a plug for WebRTC because it looks promising:

http://www.html5rocks.com/en/tutorials/webrtc/basics/

CodeShane
  • 6,480
  • 1
  • 18
  • 24
  • 1
    Shane thanks for the links, because I had no solution at the time I bought the MPEG2TS over UDP broadcaster (significantly cheaper...) and wrote a proxy code that fetches the media from the stream, buffers it to a file and allows "downloading" or progressive streaming of the file from the client. It isnt a textbook solution to the problem but we got it up and running. I hope google will show us some love in the future and add support to additional Protocols. thanks again! – Omriko Jan 21 '13 at 15:50
  • Glad you got it working, and thanks for relating your experience! – CodeShane Jan 22 '13 at 17:12
  • Could you link to what device you bought? I am interested in something similar. – egfconnor Feb 08 '14 at 04:47
  • 1
    we used two products, one from vboxcomm to handle satellite feed and one from alcad to stream movies. – Omriko Apr 17 '14 at 11:48
  • +1 @Omriko thanks for letting us know your solution. – CodeShane Apr 19 '14 at 14:28