The easiest way to play an audio RTMP stream in Android

后端 未结 2 1352
长发绾君心
长发绾君心 2020-12-02 11:43

I found some Android RTMP libraries (like this : http://rtmpdump.mplayerhq.hu/).

The problem is that there is no accurate documentation on how we can use it.

2条回答
  •  情书的邮戳
    2020-12-02 12:16

    Not sure if this helps, but... I was able to do something similar (rtmp - streaming video) using Flash, so you need Android 2.2+ for this.

    Anyway, I just wrote an HTML page displaying the flash video then opened the page in a WebView.

    
    
    
    
    
    YOUR TITLE HERE!
    
    
    
    
    
    
    
     


    Please Install Adobe Flash Player

    Get Adobe Flash player

    OK... now just save that in your assets folder in your project and open it with something like this in your activity :

        String LocalFile = "file:///android_asset/YOUR_HTML_FILE.htm";
    
        WebView webView = (WebView) findViewById(R.id.YOUR_WEB_VIEW);
        WebSettings webSettings = webView.getSettings();
        webSettings.setJavaScriptEnabled(true);
        webSettings.setPluginsEnabled(true);
    
        webSettings.setLoadWithOverviewMode(true);
        webSettings.setUseWideViewPort(true); 
        webSettings.setAllowFileAccess(true);
    
        webView.setBackgroundColor(Color.BLACK);
        webView.setVerticalScrollBarEnabled(false);
        webView.setHorizontalScrollBarEnabled(false);
        webView.loadUrl(LocalFile);
    

    Its a bit of a work around... Hope it works for you. CDub.

提交回复
热议问题