I am using Videoview to playback mp4 file from local machine using android emulator. I hear the audio, but the screen is blank and no video is seen. Android SDK 2.0.1
Does anyone have an idea what is missing here:
package com.hello;
import android.app.Activity;
import android.os.Bundle;
import android.widget.MediaController;
import android.widget.VideoView;
public class HelloAndroid extends Activity {
VideoView vv;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
vv = (VideoView) findViewById(R.id.VideoView01);
MediaController nc = new MediaController(this);
vv.setMediaController(nc);
vv.setVideoPath("/sdcard/yu.mp4");
vv.requestFocus();
vv.start();
}
public void onPause() {
vv.stopPlayback();
}
}
Main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<VideoView
android:id="@+id/VideoView01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"></VideoView>
</LinearLayout>