-1

Gdata API for YouTube feed is not working, from last some days.. so any alternative for to get feed from YouTube API..??

http://gdata.youtube.com/feeds/api/playlists/PL_yIBWagYVjyyqx_qPkbat5zufWZOyZEZ

Glorfindel
  • 21,988
  • 13
  • 81
  • 109
  • This has been addressed in dozens of posts on this tag. Search on SO or the YouTube v3 API documentation. – JAL Jun 15 '15 at 16:26

1 Answers1

-1
  1. Download YouTubePlyaer API https://developers.google.com/youtube/android/player/downloads/

  2. Register your app on google developer console https://console.developers.google.com

  3. Take an unique API Key and use that in your App.

  4. use below code

    public class AboutUs extends YouTubeBaseActivity implements YouTubePlayer.OnInitializedListener {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.layout_about_us);
    
        YouTubePlayerView youTubePlayerView = (YouTubePlayerView) findViewById(R.id.youtube_player);
        youTubePlayerView.initialize(Constants.YOUTUBE_API_KEY, this);
    
        initViews();
    }
    
    private void initViews() {
        Button btnVisitMega = (Button) findViewById(R.id.btn_visit_megaforties);
        Button btnVisitSecurity = (Button) findViewById(R.id.btn_visit_security_seals);
    
        btnVisitMega.setOnClickListener(this);
        btnVisitSecurity.setOnClickListener(this);
    }
    
    @Override
    public void onInitializationFailure(Provider arg0, YouTubeInitializationResult arg1) {
        Toast.makeText(this, "Failured to Initialize!", Toast.LENGTH_LONG).show();
    }
    
    @Override
    public void onInitializationSuccess(Provider provider, YouTubePlayer player, boolean wasRestored) {
        /** add listeners to YouTubePlayer instance **/
        player.setPlayerStateChangeListener(playerStateChangeListener);
        player.setPlaybackEventListener(playbackEventListener);
    
        /** Start buffering **/
        if (!wasRestored) {
            player.cueVideo(Constants.YOUTUBE_VIDEO_ID);
        }
    }
    
    private PlaybackEventListener playbackEventListener = new PlaybackEventListener() {
    
        @Override
        public void onBuffering(boolean arg0) {
        }
    
        @Override
        public void onPaused() {
        }
    
        @Override
        public void onPlaying() {
        }
    
        @Override
        public void onSeekTo(int arg0) {
        }
    
        @Override
        public void onStopped() {
        }
    };
    
    private PlayerStateChangeListener playerStateChangeListener = new PlayerStateChangeListener() {
    
        @Override
        public void onAdStarted() {
        }
    
        @Override
        public void onError(ErrorReason arg0) {
        }
    
        @Override
        public void onLoaded(String arg0) {
        }
    
        @Override
        public void onLoading() {
        }
    
        @Override
        public void onVideoEnded() {
        }
    
        @Override
        public void onVideoStarted() {
        }
    };
    
Vid
  • 1,012
  • 1
  • 14
  • 29
  • Vid, i m not looking to play the video.....read the question ... i need the feed of playlist... :( – Rahul Ranjan Jun 15 '15 at 07:36
  • Oh, Check out this link. https://developers.google.com/youtube/2.0/developers_guide_protocol_api_query_parameters?csw=1 – Vid Jun 15 '15 at 07:40
  • @Vid that's a link to the v2 API, it doesn't help the asker. – JAL Jun 15 '15 at 16:25