Created
February 11, 2019 19:04
-
-
Save PierfrancescoSoffritti/e9ce716c8c9b9ad8e25977eaea3efac4 to your computer and use it in GitHub Desktop.
android-youtube-player, an open source alternative to the official YouTube Player API: https://medium.com/@soffritti.pierfrancesco/how-to-play-youtube-videos-in-your-android-app-c40427215230
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
YouTubePlayerView youTubePlayerView = findViewById(R.id.youtube_player_view); | |
getLifecycle().addObserver(youTubePlayerView); | |
youTubePlayerView.addYouTubePlayerListener(new AbstractYouTubePlayerListener() { | |
@Override | |
public void onReady(@NonNull YouTubePlayer youTubePlayer) { | |
String videoId = "S0Q4gqBUs7c"; | |
youTubePlayer.loadVideo(videoId, 0f); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment