YouTubePlayerView Android - Display End Screens
up vote
0
down vote
favorite
I wish to display endscreen associated with the YouTube video in my app. So how to configure YouTubePlayerView to display end screens in Android app. Below is the code used to play YouTube video in my app
youTubePlayerView.initialize(new Keys().YTKey(), new YouTubePlayer.OnInitializedListener() {
@Override
public void onInitializationSuccess(YouTubePlayer.Provider provider, YouTubePlayer youTubePlayer, boolean wasRestored)
{
// Defining player
player = youTubePlayer;
// Setting flag for the player to play video in fullscreen mode when switched to landscaper orientation
player.setFullscreenControlFlags(YouTubePlayer.FULLSCREEN_FLAG_CONTROL_ORIENTATION | YouTubePlayer.FULLSCREEN_FLAG_ALWAYS_FULLSCREEN_IN_LANDSCAPE);
// Checking whether video is restored or not
if (!wasRestored)
{
// If not restored load video
player.loadVideo(videoId);
player.setPlayerStyle(YouTubePlayer.PlayerStyle.DEFAULT);
}
else
{
// Else play the restored video
player.play();
}
}
@Override
public void onInitializationFailure(YouTubePlayer.Provider provider, YouTubeInitializationResult youTubeInitializationResult) {
Toast.makeText(getBaseContext(), "Failed to Initialize Player", Toast.LENGTH_LONG).show();
}
});
android youtube-api youtube-api-v3 android-youtube-api
add a comment |
up vote
0
down vote
favorite
I wish to display endscreen associated with the YouTube video in my app. So how to configure YouTubePlayerView to display end screens in Android app. Below is the code used to play YouTube video in my app
youTubePlayerView.initialize(new Keys().YTKey(), new YouTubePlayer.OnInitializedListener() {
@Override
public void onInitializationSuccess(YouTubePlayer.Provider provider, YouTubePlayer youTubePlayer, boolean wasRestored)
{
// Defining player
player = youTubePlayer;
// Setting flag for the player to play video in fullscreen mode when switched to landscaper orientation
player.setFullscreenControlFlags(YouTubePlayer.FULLSCREEN_FLAG_CONTROL_ORIENTATION | YouTubePlayer.FULLSCREEN_FLAG_ALWAYS_FULLSCREEN_IN_LANDSCAPE);
// Checking whether video is restored or not
if (!wasRestored)
{
// If not restored load video
player.loadVideo(videoId);
player.setPlayerStyle(YouTubePlayer.PlayerStyle.DEFAULT);
}
else
{
// Else play the restored video
player.play();
}
}
@Override
public void onInitializationFailure(YouTubePlayer.Provider provider, YouTubeInitializationResult youTubeInitializationResult) {
Toast.makeText(getBaseContext(), "Failed to Initialize Player", Toast.LENGTH_LONG).show();
}
});
android youtube-api youtube-api-v3 android-youtube-api
Can you add any details like: code used, error problem encountered? How do I ask a good question?, How to create a Minimal, Complete, and Verifiable example Show the community what you have tried.
– Jacque
Nov 21 at 5:15
@Jacque Edited my question. Pls do have a look
– Aditya Borde
Nov 21 at 6:50
Sorry. After actually looking around, it seems this is still not possible.
– Jacque
Nov 22 at 1:40
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I wish to display endscreen associated with the YouTube video in my app. So how to configure YouTubePlayerView to display end screens in Android app. Below is the code used to play YouTube video in my app
youTubePlayerView.initialize(new Keys().YTKey(), new YouTubePlayer.OnInitializedListener() {
@Override
public void onInitializationSuccess(YouTubePlayer.Provider provider, YouTubePlayer youTubePlayer, boolean wasRestored)
{
// Defining player
player = youTubePlayer;
// Setting flag for the player to play video in fullscreen mode when switched to landscaper orientation
player.setFullscreenControlFlags(YouTubePlayer.FULLSCREEN_FLAG_CONTROL_ORIENTATION | YouTubePlayer.FULLSCREEN_FLAG_ALWAYS_FULLSCREEN_IN_LANDSCAPE);
// Checking whether video is restored or not
if (!wasRestored)
{
// If not restored load video
player.loadVideo(videoId);
player.setPlayerStyle(YouTubePlayer.PlayerStyle.DEFAULT);
}
else
{
// Else play the restored video
player.play();
}
}
@Override
public void onInitializationFailure(YouTubePlayer.Provider provider, YouTubeInitializationResult youTubeInitializationResult) {
Toast.makeText(getBaseContext(), "Failed to Initialize Player", Toast.LENGTH_LONG).show();
}
});
android youtube-api youtube-api-v3 android-youtube-api
I wish to display endscreen associated with the YouTube video in my app. So how to configure YouTubePlayerView to display end screens in Android app. Below is the code used to play YouTube video in my app
youTubePlayerView.initialize(new Keys().YTKey(), new YouTubePlayer.OnInitializedListener() {
@Override
public void onInitializationSuccess(YouTubePlayer.Provider provider, YouTubePlayer youTubePlayer, boolean wasRestored)
{
// Defining player
player = youTubePlayer;
// Setting flag for the player to play video in fullscreen mode when switched to landscaper orientation
player.setFullscreenControlFlags(YouTubePlayer.FULLSCREEN_FLAG_CONTROL_ORIENTATION | YouTubePlayer.FULLSCREEN_FLAG_ALWAYS_FULLSCREEN_IN_LANDSCAPE);
// Checking whether video is restored or not
if (!wasRestored)
{
// If not restored load video
player.loadVideo(videoId);
player.setPlayerStyle(YouTubePlayer.PlayerStyle.DEFAULT);
}
else
{
// Else play the restored video
player.play();
}
}
@Override
public void onInitializationFailure(YouTubePlayer.Provider provider, YouTubeInitializationResult youTubeInitializationResult) {
Toast.makeText(getBaseContext(), "Failed to Initialize Player", Toast.LENGTH_LONG).show();
}
});
android youtube-api youtube-api-v3 android-youtube-api
android youtube-api youtube-api-v3 android-youtube-api
edited Nov 21 at 6:50
asked Nov 20 at 5:21
Aditya Borde
5981622
5981622
Can you add any details like: code used, error problem encountered? How do I ask a good question?, How to create a Minimal, Complete, and Verifiable example Show the community what you have tried.
– Jacque
Nov 21 at 5:15
@Jacque Edited my question. Pls do have a look
– Aditya Borde
Nov 21 at 6:50
Sorry. After actually looking around, it seems this is still not possible.
– Jacque
Nov 22 at 1:40
add a comment |
Can you add any details like: code used, error problem encountered? How do I ask a good question?, How to create a Minimal, Complete, and Verifiable example Show the community what you have tried.
– Jacque
Nov 21 at 5:15
@Jacque Edited my question. Pls do have a look
– Aditya Borde
Nov 21 at 6:50
Sorry. After actually looking around, it seems this is still not possible.
– Jacque
Nov 22 at 1:40
Can you add any details like: code used, error problem encountered? How do I ask a good question?, How to create a Minimal, Complete, and Verifiable example Show the community what you have tried.
– Jacque
Nov 21 at 5:15
Can you add any details like: code used, error problem encountered? How do I ask a good question?, How to create a Minimal, Complete, and Verifiable example Show the community what you have tried.
– Jacque
Nov 21 at 5:15
@Jacque Edited my question. Pls do have a look
– Aditya Borde
Nov 21 at 6:50
@Jacque Edited my question. Pls do have a look
– Aditya Borde
Nov 21 at 6:50
Sorry. After actually looking around, it seems this is still not possible.
– Jacque
Nov 22 at 1:40
Sorry. After actually looking around, it seems this is still not possible.
– Jacque
Nov 22 at 1:40
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53386686%2fyoutubeplayerview-android-display-end-screens%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Can you add any details like: code used, error problem encountered? How do I ask a good question?, How to create a Minimal, Complete, and Verifiable example Show the community what you have tried.
– Jacque
Nov 21 at 5:15
@Jacque Edited my question. Pls do have a look
– Aditya Borde
Nov 21 at 6:50
Sorry. After actually looking around, it seems this is still not possible.
– Jacque
Nov 22 at 1:40