VideoView Not Playing, Error(1,-1)

Posted by Jesse J on Stack Overflow See other posts from Stack Overflow or by Jesse J
Published on 2012-07-07T02:38:36Z Indexed on 2012/07/07 3:15 UTC
Read the original article Hit count: 243

I originally thought that the video format was wrong, but after trying .mov, .3gp, and .mp4 with H.264, I'm wondering if something is wrong with my code?

public class IntroActivity extends Activity
{
VideoView videoHolder;

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

@Override
protected void onStart()
{
    getWindow().setFormat(PixelFormat.TRANSLUCENT);
    videoHolder = new VideoView(this);
    //videoHolder = (VideoView)findViewById(R.id.myvideoview);
    Uri video = Uri.parse("android.resource://" + getPackageName() + "/" + R.raw.menu);
    videoHolder.setVideoURI(video);
    videoHolder.start();

    videoHolder.setOnCompletionListener(new MediaPlayer.OnCompletionListener()
    {
        public void onCompletion(MediaPlayer mp)
        {
            videoHolder.start();

        }
    });

    setContentView(videoHolder);

    super.onStart();
}

© Stack Overflow or respective owner

Related posts about android

Related posts about android-mediaplayer