Question

Hey folks,i am developing a RTP client on an Android device which can play streaming videos from a server. I am confused regarding how should i start about? i am thinking of developing a web app, using HTML,CSS and Javascript, which can later be wrapped in Android.is this approach correct? does javascript support real time media player? please guide me, i am a fresher and completely clueless..:(

Was it helpful?

Solution

You should play your video with MediaPlayer. Of course you can prepare dedicated website that lists available streams and wrap it up into WebView. Having this stream list in WebView you can write interface that will bind javascript on your webpage with proper interface in your Android code. Check out this section of Android Dev Guide:

And here is a list of supported media formats

I successfully played rtsp stream on Android 2.2 but I'm not sure if it's supported on previous versions.

To sum up.

  1. Prepare website with javascript code and streams list

  2. Create layout with webview with javascript enabled for example:

    Webview wv = (WebView) findViewById(R.id.WebView01);
    wv.setJavaScriptEnabled(true);
    
  3. Add class that will be invoked by javascript like in the Dev Guide above:

    wv.addJavascriptInterface(new JavaScriptInterface(this), "Android");`
    
  4. Play stream with MediaPlayer

Hope that helps.

OTHER TIPS

I guess you may setup a streaming media server(live555, darwin stream server) to publish media file in rtsp protocol, and use VideoView on android to play it

If you create normal android app then MediaPlayer class will handle everything for you. Just feed it with rtp stream url, that is it.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top