Beni Beni - 1 year ago 172
Android Question

Why Videoview can't play a Youtube Video?

I'm trying to play a Youtube video from Youtube on some devices, but they return a dialog: "The video can't be played".

I've already read the Youtube API Documentation.

I've a VideoView and I set the video Uri as a url with a .3pg extension.

This is my code:

VideoView videoView = (VideoView)this.findViewById(;
MediaController mc = new MediaController(this);

I've tried other videos and play correctly. What am I doing wrong?

Answer Source

If embedding video is not your explicit requirement, Why don't you simply start an intent with the Youtube video URL and let the OS handle the intent for you ? This is the simplest possible way to play video on android as far as I know. For example,

Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("Your youtube URL here"));

For more information about Android Intents, see this link and vogella's tutorial

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download