1. Check out our app, Forums for Android! Download and leave feedback here!

Playing Video in app

Discussion in 'Application Development' started by Riddler, Oct 23, 2009.

  1. Riddler

    Riddler New Member
    Thread Starter
    5

    Oct 23, 2009
    3
    0
    5
    Hi Folks,

    I am currently developing a small app which has an option to play a few videos. However, i have tried to use a number of different conversion tools but none of the videos seem to play.

    Tried converting to mp4 (.h264), wmv, 3pg(.h264)

    The code i am using is below

    @Override
    public void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    setContentView(R.layout.videoPlayer);
    playVideo();
    }

    private void playVideo() {
    doCleanUp();
    try {
    VideoView video = (VideoView) this.findViewById(R.id.trailerView);
    Uri uri = Uri.parse("android.resource://com.mytest.player/" + R.raw.test);
    video.setVideoURI(uri);
    video.setMediaController(new MediaController(this));
    video.requestFocus();
    video.setOnCompletionListener(this);
    video.start();
    } catch (Exception e) {
    Log.e(TAG, "error: " + e.getMessage(), e);
    }
    }

    Is there something fundamental i am doing wrong here or is it simply done to the videos i am using.

    Regards,
    Stephen
     

    Advertisement

Share This Page

Loading...