Bart Bergmans
Bart Bergmans

Reputation: 4121

What is the best way to auto play YouTube videos on Glass?

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?

Upvotes: 0

Views: 228

Answers (1)

Simon Marquis
Simon Marquis

Reputation: 7516

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);  

Upvotes: 1

Related Questions