Quantcast
Channel: Active questions tagged youtube-api - Stack Overflow
Viewing all articles
Browse latest Browse all 3637

How to Remove Related Videos in Android Youtube API for Youtube Videos?

$
0
0

I have developed Android with Youtube videos. After the video got completed, I am getting suggestions from youtube like (you may also like these videos).I want to remove the Related videos in Youtube videos.

this.video_youtube_player =(YouTubePlayerView) findViewById(R.id.video_youtube_player);        this.onInitializedListinner =  new YouTubePlayer.OnInitializedListener(){            @Override            public void onInitializationSuccess(YouTubePlayer.Provider provider, YouTubePlayer youTubePlayer, boolean b) {                youTubePlayer.loadVideo(new YouTubeHelper().extractVideoIdFromUrl(original));                youTubePlayer.setPlayerStyle(YouTubePlayer.PlayerStyle.MINIMAL);                youTubePlayer.setPlayerStateChangeListener(new YouTubePlayer.PlayerStateChangeListener() {                    @Override                    public void onLoading() {                    }                    @Override                    public void onLoaded(String s) {                  }                    @Override                    public void onAdStarted() {                  }                    @Override                    public void onVideoStarted() {                }                    @Override                    public void onVideoEnded() {                    }                    @Override                    public void onError(YouTubePlayer.ErrorReason errorReason) {                   }                });            }            @Override            public void onInitializationFailure(YouTubePlayer.Provider provider, YouTubeInitializationResult youTubeInitializationResult) {            }        };        video_youtube_player.initialize(Global.Youtube_Key,onInitializedListinner);    }    public class YouTubeHelper {        final String youTubeUrlRegEx = "^(https?)?(://)?(www.)?(m.)?((youtube.com)|(youtu.be))/";        final String[] videoIdRegex = { "\\?vi?=([^&]*)","watch\\?.*v=([^&]*)", "(?:embed|vi?)/([^/?]*)", "^([A-Za-z0-9\\-]*)"};        public String extractVideoIdFromUrl(String url) {            String youTubeLinkWithoutProtocolAndDomain = youTubeLinkWithoutProtocolAndDomain(url);            for(String regex : videoIdRegex) {                Pattern compiledPattern = Pattern.compile(regex);                Matcher matcher = compiledPattern.matcher(youTubeLinkWithoutProtocolAndDomain);                if(matcher.find()){                    return matcher.group(1);                }            }            return null;        }

Please provide solution on this, I have added small snippet above,How to disable them and click on these videos open Youtube app as well.How to prevent it from open youtube app/ youtube website while clicking them.

Is it acceptable by youtube with AdMob?Thanks in advance.


Viewing all articles
Browse latest Browse all 3637

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>