Spoofy
Spoofy

Reputation: 651

Android VideoView not playing video

I have a problem with my VideoView. Just tried to make 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 get this errors:

enter image description here

Sometimes i just get the sound but black videoscreen. Plus i dont get any errors in my LogCat!

Upvotes: 3

Views: 1528

Answers (2)

Sirelon
Sirelon

Reputation: 7066

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

And if you want showing youtube video you need to usage youtube API

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

Upvotes: 0

ka98
ka98

Reputation: 17

A video view in android does not support any .aspx videos. You should use .mp4, .3gb, .mkv or .webm instead.

Have a closer look here at the video-section : http://developer.android.com/guide/appendix/media-formats.html#core

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

I Hope this really helps you

Upvotes: 1

Related Questions