开发者

sample code to implement rtmp in android

开发者 https://www.devze.com 2023-01-19 01:55 出处:网络
I want to play online radio in android application? It can be done RTMP. But i am not aware how to move ahead.

I want to play online radio in android application? It can be done RTMP. But i am not aware how to move ahead. Can some one throw light on this?

i am able to play static mp3 file here s below working code:

package org.example.video;
import android.view.KeyEvent;
import android.view.View;
import android.widget.VideoView;

import android.app.Activity;
import android.content.Context;
import android.net.Uri;
import android.os.Bundle;
import android.widget.VideoView;
import android.media.*;

public class Video extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.lay开发者_如何学Goout.main);
        setVolumeControlStream(AudioManager.STREAM_MUSIC);

        Context appContext = getApplicationContext();

        MediaPlayer urlPlayer = MediaPlayer.create(appContext,
        Uri.parse("http://naachradio.com/data/addSound.mp3"));

        urlPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);


    //  urlPlayer.prepare();
        urlPlayer.start();



     }
    }
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号