Search

'Android 라디오 mms 주소로 듣기'에 해당되는 글 1건

  1. 2013.08.16 Android 라디오 mms 주소로 듣기 1

Android 라디오 mms 주소로 듣기

Programming/Android 2013. 8. 16. 17:28 Posted by TanSanC
336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.

package com.tistory.tansanc.Test130805;

import java.io.IOException;

import android.app.Activity;
import android.content.Intent;
import android.media.MediaPlayer;
import android.media.MediaPlayer.OnPreparedListener;
import android.net.Uri;
import android.os.Bundle;
import android.util.Log;
import android.view.View;

public class MainActivity extends Activity implements OnPreparedListener {

	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);

	}

	MediaPlayer player;

	public void mOnClick(View v) {

		try {
			Intent it = new Intent(Intent.ACTION_VIEW);
			Uri uri = Uri.parse("mms://114.108.140.39/magicfm_live");
			it.setDataAndType(uri, "video/mp4");
			startActivity(it);
		} catch (IllegalArgumentException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (SecurityException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IllegalStateException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

	public void onPrepared(MediaPlayer player) {
		Log.d("Start onPrepared", "Start onPrepared");
		player.start();
	}
}