Hi! I have a problem with playing videos through mediaplayer. I have a
sound but no video. I was searching a lot of thread but can't find
solve for my problem. Is is something wrong with the code? Or is it
something else. Here's the code:
public class TestStream1 extends Activity implements Callback{
MediaPlayer mMediaPlayer;
String SrcPath = "rtsp://184.72.239.149/vod/
mp4:BigBuckBunny_175k.mov";
private SurfaceView mPreview;
private SurfaceHolder holder;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
mPreview = (SurfaceView) findViewById(R.id.myvideoview);
holder = mPreview.getHolder();
holder.addCallback(TestStream1.this);
holder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
holder.setFixedSize(400,300);
mMediaPlayer = new MediaPlayer();
try{
mMediaPlayer.setDataSource(SrcPath);
mMediaPlayer.setDisplay(holder);
mMediaPlayer.prepare();
mMediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
mMediaPlayer.start();
}catch(Exception e){
Toast .makeText( TestStream1.this, "Fail",
Toast.LENGTH_LONG).show();
}
}
}
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en