Friday, December 30, 2011

[YouTube-API] Play YouTube video inside Android app

I need to run a YouTube player inside my Android app and control it
from the app (play button, know when the video ended...) .
I try to use a webview as my solution but failed:
When I try to use the new iframe API (http://code.google.com/apis/
youtube/iframe_api_reference.html#Examples
) the video won't play and I
get this error:
Web Console(21500): Unable to post message to http://www.youtube.com.
Recipient has origin file://.

When I try to use the JavaScript API (http://code.google.com/apis/
youtube/js_api_reference.html
) the movie is playing but trying to call
JS function on the player failed. I get this error:
E/Web Console(21722): Uncaught TypeError: Object #<an
HTMLObjectElement> has no method 'loadVideoById' at file:///android_asset/demo1.html:16

So I can play the video but can't control the player.

Any Idea how to play YouTube videos and control the player on Android?
(Code samples will be appreciate :) )

Thanks and Happy new year,
Daniel

--
You received this message because you are subscribed to the Google Groups "YouTube APIs Developer Forum" group.
To post to this group, send email to youtube-api-gdata@googlegroups.com.
To unsubscribe from this group, send email to youtube-api-gdata+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/youtube-api-gdata?hl=en.

No comments:

Post a Comment