Newbie problems with local video file

All your problems with Audio, Video and Images.

Newbie problems with local video file

Postby danova » Tue Nov 02, 2010 11:03 am

Hello, I'm trying to reproduce the Apidemos videoview.java. I cannot play video (get teh video cannot be played)
Here is my code: ANy help would be really helpful !!!

#########
# rtva.java
#########
package com.rtva.player;

import com.rtva.player.R;
import android.app.Activity;
import android.os.Bundle;
import android.widget.MediaController;
import android.widget.Toast;
import android.widget.VideoView;

public class rtva extends Activity {

private String path = "/tmp/sample_mpeg4.mp4"; # path on my linux PC

public void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.videoview);
VideoView mVideoView = (VideoView) findViewById(R.id.video_view);


if (path == "") {
// Tell the user to provide a media file URL/path.
Toast.makeText(
rtva.this,
"Please edit rtva Activity, and set path"
+ " variable to your media file URL/path",
Toast.LENGTH_LONG).show();

} else {
((VideoView) mVideoView).setVideoPath(path);
((VideoView) mVideoView).setMediaController(new MediaController(this));
mVideoView.requestFocus();
}
}
}

#############
#videoview.xml
#############
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
>

<VideoView
android:id="@+id/video_view"
android:layout_width="320px"
android:layout_height="240px"
/>


</LinearLayout>

thanks for your help !!!
danova
Once Poster
Once Poster
 
Posts: 1
Joined: Tue Nov 02, 2010 10:48 am

Top

Return to Multimedia Problems

Who is online

Users browsing this forum: No registered users and 13 guests