android - Why Videoview can't play a Youtube Video? -


i'm trying play youtube video youtube on devices, return dialog: "the video can't played".

i've read youtube api documentation.

i've videoview , set video uri url .3pg extension.

this code:

 videoview videoview = (videoview)this.findviewbyid(r.id.video);   mediacontroller mc = new mediacontroller(this);   videoview.setmediacontroller(mc);  videoview.setvideouri(uri.parse("rtsp://v1.cache2.c.youtube.com/cigleny73wiahwmhxroroaqgpbmyesarfeggugx1c2vyx3vwbg9hzhmm/0/0/0/video.3gp"));   videoview.requestfocus();   videoview.start(); 

i've tried other videos , play correctly. doing wrong?

if embedding video not explicit requirement, why don't start intent youtube video url , let os handle intent ? simplest possible way play video on android far know. example,

intent intent = new intent(intent.action_view, uri.parse("your youtube url here")); startactivity(intent); 

for more information android intents, see this link , vogella's tutorial


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -