[android-beginners] Playing a Video from file

2009-12-13 Thread Valentino XM
Help!

code code code, playing a video from file.. using the video view
widget. not at all successful. the developers page claims this is
easy.. i beg to differ... for first time coders, very frutstrating..
if you can help., please do.



package info.shouraig.com;

import android.app.Activity;
import android.net.Uri;
import android.os.Bundle;
import android.util.Log;
import android.widget.VideoView;

public class XSO3 extends Activity {
private static final String TAG = XSO3;
VideoView videoXSO3;

/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Log.d(TAG,onCreate started);


VideoView video = (VideoView) this.findViewById
(R.id.VideoXSO3); my title

Uri uri = Uri.parse(//info.shouraig.com/ + R.raw.C:/
XSCycling2.mp4); my video
video.setVideoURI(uri);
video.setMediaController(new VideoView(this));
video.requestFocus();
video.setOnCompletionListener(this);
video.start();



}AssetFileDescriptor afd = getResources().openRawResourceFd
(R.raw.video);

// Create a new media player and set the listeners
mMediaPlayer = new MediaPlayer();

mMediaPlayer.setDataSource(afd.getFileDescriptor(),
afd.getStartOffset(), afd.getLength());

-- 
You received this message because you are subscribed to the Google
Groups Android Beginners group.
To post to this group, send email to android-beginners@googlegroups.com
To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en


Re: [android-beginners] Playing a Video from file

2009-12-13 Thread Yousuf Syed
I dont think you can place the video file in the raw folder. since there is
a limit of data that you can have in your raw folder.

try pushing it to the /sdcard/videofilename and add permissions for
read_owner_data, write_owner_data, write_external_storage.

I assume you know the procedure to push files to sdcard.

Regards,

Yousuf.

On Fri, Dec 11, 2009 at 7:10 AM, Valentino XM shourai...@gmail.com wrote:

 Help!

 code code code, playing a video from file.. using the video view
 widget. not at all successful. the developers page claims this is
 easy.. i beg to differ... for first time coders, very frutstrating..
 if you can help., please do.



 package info.shouraig.com;

 import android.app.Activity;
 import android.net.Uri;
 import android.os.Bundle;
 import android.util.Log;
 import android.widget.VideoView;

 public class XSO3 extends Activity {
private static final String TAG = XSO3;
VideoView videoXSO3;

/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Log.d(TAG,onCreate started);


VideoView video = (VideoView) this.findViewById
 (R.id.VideoXSO3); my title

Uri uri = Uri.parse(//info.shouraig.com/ + R.raw.C:/
 XSCycling2.mp4); my video
video.setVideoURI(uri);
video.setMediaController(new VideoView(this));
video.requestFocus();
video.setOnCompletionListener(this);
video.start();



 }AssetFileDescriptor afd = getResources().openRawResourceFd
 (R.raw.video);

 // Create a new media player and set the listeners
 mMediaPlayer = new MediaPlayer();

 mMediaPlayer.setDataSource(afd.getFileDescriptor(),
 afd.getStartOffset(), afd.getLength());

 --
 You received this message because you are subscribed to the Google
 Groups Android Beginners group.
 To post to this group, send email to android-beginners@googlegroups.com
 To unsubscribe from this group, send email to
 android-beginners+unsubscr...@googlegroups.comandroid-beginners%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-beginners?hl=en

-- 
You received this message because you are subscribed to the Google
Groups Android Beginners group.
To post to this group, send email to android-beginners@googlegroups.com
To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en