Android VideoView not playing video

I have a problem with my VideoView. Just tried making a simple example:

public class MainActivity extends ActionBarActivity {

String url = "http://videoguides.avs4you.com/How-to-convert-3GP-video.aspx";
VideoView video;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

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

    video.setVideoPath(url);
    video.start();
    Toast.makeText(getBaseContext(),url,Toast.LENGTH_LONG).show();

}

      

}

But I am getting the following errors:

enter image description here

Sometimes I just get sound but a black video screen. Plus I am not getting any errors in my LogCat!

+3


source to share


2 answers


Watching video in android does not support video .aspx

. Instead, use the .mp4

, .3gb

, .mkv

, or .webm

.

Check out the video section in more detail: http://developer.android.com/guide/appendix/media-formats.html#core



Here's an example for a video where you can use instad (for testing): http://clips.vorwaerts-gmbh.de/VfE_html5.mp4

Hope this really helps you.

+1


source


Your url returned html code and VideoView needed streaming resource (full path to video).

And if you want to show youtube videos, you need to use youtube API



See also https://developers.google.com/youtube/android/player/

0


source







All Articles