Hi all,
After trying to play video on emulator for the last 2 days, I finally
succeeded after reading some post about it.
I want to share it for those who might want to try it.
so enjoy!
here is my code:
package com.myMediaPlayer;
import android.app.Activity;
import android.content.Intent;
import android.graphics.PixelFormat;
import android.net.Uri;
import android.os.Bundle;
import android.widget.MediaController;
import android.widget.VideoView;
public class MediaPlayer extends Activity {
VideoView videoHolder;
String path="http://www.pocketjourney.com/downloads/pj/video/famous.
3gp";
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.video_layout);
getWindow().setFormat(PixelFormat.TRANSLUCENT);
videoHolder = (VideoView) findViewById(R.id.video_view1);
MediaController mediaController = new MediaController(this);
mediaController.setMediaPlayer(videoHolder);
videoHolder.setVideoPath(path);
videoHolder.setMediaController(mediaController );
videoHolder.requestFocus();
videoHolder.start();
mediaController.show();
}
}
This is my video.layout.xml :
<?xml version="1.0" encoding="utf-8"?>
<VideoView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/video_view1">
</VideoView>
hope it will help somebody who need it like I was...
Best Regards,
Oran
--
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