0

I want to integrate video player for you tube specially. I found youtube android player tools but i did not find implementation.

And I have implemented android-youtube-player. but it is not working.

If anyone has integrated then need help.

Marcin Orlowski
  • 72,056
  • 11
  • 123
  • 141
Bhavesh Hirpara
  • 22,255
  • 15
  • 63
  • 104

3 Answers3

2

The YouTube Andoid Player presentation was made at Google I/O 2012 and the Android Player API is not yet publicly available (As of 21st Nov 2012). That presentation is the only public information I'm aware of.

(Update: It's now been publicly announced, and released as an experimental API: http://apiblog.youtube.com/2012/12/no-webview-required-with-native-youtube.html )

The android-youtube-player library is unofficial. I suggest you read the YouTube API Terms of Service:

https://developers.google.com/youtube/terms

In particular, you may not use any player other than the official YouTube players.

I have heard reports of the iframe API working by embedding it in an embedded web view - but I can't verify those reports personally, or how to deal with issues such as cross domain messaging and cross-language bindings between java and the dom javascript bindings.

The easiest way to load a YouTube video from an android app is to call for the OS to load the YouTube video using intents.

Given there is an Android library in development at YouTube (from your link), I would suggest using the quickest and easiest method available for now, and potentially using that API in a later update.

There's more discussion on calling to start the video in the YouTube app here: Android YouTube app Play Video Intent

Community
  • 1
  • 1
Tim Wintle
  • 2,423
  • 1
  • 17
  • 15
  • yuap.. but it will start browser or you-tube official app. – Bhavesh Hirpara Nov 21 '12 at 09:37
  • 1
    I believe it should start whichever the user has chosen to open youtube urls with. – Tim Wintle Nov 21 '12 at 16:40
  • +1 for your answer. I want to play video with advertisement. that is why i want custom player. waiting for you tube player API from google. :) – Bhavesh Hirpara Nov 22 '12 at 07:50
  • 1
    I can update you - the Android player library is now an experimental realease http://apiblog.youtube.com/2012/12/no-webview-required-with-native-youtube.html – Tim Wintle Dec 22 '12 at 09:35
  • ...It requires you tube app :D :D. Actually I wanted to integrate in app without depending on you tube. :). Will do. – Bhavesh Hirpara Dec 22 '12 at 10:10
  • It requires the YouTube app to have been installed on the device, however it doesn't open the video inside the app, and you can insert the player into your own app as you would any view. The main player classes are kept updated with the YouTube App - your app only needs to link against a fairly compact jar to work with it. (Side note - I believe that YouTube Intents are now documented publicly for the first time as well) – Tim Wintle Dec 22 '12 at 21:22
0
Intent i = new Intent ( Intent . ACTION_VIEW , Uri . parse ( "vnd.youtube:" + videoID )); 
List < ResolveInfo > list = getPackageManager (). queryIntentActivities ( i , PackageManager . MATCH_DEFAULT_ONLY ); 
        if ( list . size () == 0 ) {
            //write you own activity to display the video, if default youtube video display class is not available or else use the default class it self
            }

        System.out.println("Intent Actin :"+i.getAction());
        startActivity ( i );
kumar
  • 691
  • 1
  • 7
  • 16
0

Right now, the only feasible method I have had success with is embedding the content into a webview using html5. Unfortunately this limits the API level to 13 or so. You don't go outside of the app, however the play and pause controls are within the webview, and I can't figure out how determine when a video completes.

The concept of making user 'leave' your app to use the YouTube player itself via intents is laughable. If you are doing something more than just playing a video (like we need an app that only plays one video) then you need them to come back to make the app worthwhile and novel. Using the native player with an rstp stream is an option, however usually the video resolution is some small weird 172x90 or so, probably not acceptable.

I have implemented with the webview, but am holding off releasing the app waiting for the Android player API that Tim mentions. As for release date, I only have this: YouTubePlayerAPI Schedule for Distribution?

Seems unseemly to highlight this great stuff that we need for Android, in July, and then nothing for months, especially when there are much more straightforward, robust methods in IOS. I spent time and resources developing an app with the expectation of using this api in a reasonable future, and feel let down considering the lack of followup and overall poor communication regarding this api.

Community
  • 1
  • 1
kittka
  • 241
  • 1
  • 3
  • 10