0

I need a way to automatically play a YouTube video on my Google Glass. I tried the Youtube JS API but after .playVideo() the video doesn't play, it only shows a black screen. I tried embed the video with the autoplay function but it doesn't autoplay. I can play embedded videos only when I click the play button myself.

Is there a simple way to (auto)play a youtube video full screen?

Bart Bergmans
  • 4,061
  • 3
  • 28
  • 56
  • You are able to successfully play embedded videos on Glass through the YouTube JS API? Documentation states that that particular API requires Flash Player to be installed. – Koh Nov 13 '14 at 20:14

1 Answers1

1

If you want to have full control over the video player, you can use the YouTube Android Player API.
You can find more info here.

You'll have to:

  • Download the API client library
  • Register your application through the Google APIs console
  • Setup the library and integrate the YoutubePlayer in your Activity

Take a look at the demo, and especially at the FullscreenDemoActivity.

Edit: A simpler method would be to use this Intent:

Intent i = new Intent();
i.setAction("com.google.glass.action.VIDEOPLAYER");
i.putExtra("video_url", "https://m.youtube.com/watch?v=xxxxxxx"); 
startActivity(i);  
Simon Marquis
  • 7,248
  • 1
  • 28
  • 43
  • 1
    As mentioned in an answer to [this](http://stackoverflow.com/questions/26412290/how-to-authenticate-when-using-videoplayer), "com.google.glass.action.VIDEOPLAYER is an undocumented intent that is likely to change without any notice. There's no official support for it..." Please do keep that in mind. – Koh Nov 17 '14 at 17:23