Hello fellow Androids!

I have been attempting, in vain, to play video via "VideoView" using
the code below and several variations there of.
Of course i am a new!.. but waiting for any assistance to come from
"beginners" has proven to be an exaperational pause in my effort to
learn something new. We were all newbees at one point, so what do you
say;   little help!? All I would like to do at this point is to play
video from source file. I am using Eclipse, Android 2.1

TIA

Cheers


package info.shouraig.com;

import android.R.raw;
import android.app.Activity;
import android.content.res.AssetFileDescriptor;
import android.media.MediaPlayer;
import android.media.MediaPlayer.OnCompletionListener;
import android.net.Uri;
import android.os.Bundle;
import android.widget.MediaController;
import android.widget.VideoView;

public class XSO4 extends Activity {
        private static final String TAG = "XSO4";
        VideoView videoXSO4;

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

        VideoView = (VideoView)findViewById(R.id.videoXSO4);



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

        // Create a new media player and set the listeners

        MediaPlayer.setDataSource(R.raw.XSCycling.mp4);
        MediaPlayer.setDisplay(Holder);
        MediaPlayer.prepare();

        mMediaPlayer.setOnBufferingUpdateListener(this);
        mMediaPlayer.setOnCompletionListener(this);
        mMediaPlayer.setOnPreparedListener(this);
        mMediaPlayer.setAudioStreamType



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

VideoView video = (VideoView)findViewById(R.id.videoXSO4);



Uri uri = Uri.parse("android.resource://info.shouraig.com/" +
R.raw.toString());
video.setVideoURI(uri);
video.setMediaController(new MediaController(this));
video.requestFocus();
video.setOnCompletionListener((OnCompletionListener) this);
video.start();


    }
}

-- 
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

Reply via email to