本文整理匯總了Java中com.google.android.youtube.player.YouTubePlayer.FULLSCREEN_FLAG_ALWAYS_FULLSCREEN_IN_LANDSCAPE屬性的典型用法代碼示例。如果您正苦於以下問題:Java YouTubePlayer.FULLSCREEN_FLAG_ALWAYS_FULLSCREEN_IN_LANDSCAPE屬性的具體用法?Java YouTubePlayer.FULLSCREEN_FLAG_ALWAYS_FULLSCREEN_IN_LANDSCAPE怎麽用?Java YouTubePlayer.FULLSCREEN_FLAG_ALWAYS_FULLSCREEN_IN_LANDSCAPE使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類com.google.android.youtube.player.YouTubePlayer
的用法示例。
在下文中一共展示了YouTubePlayer.FULLSCREEN_FLAG_ALWAYS_FULLSCREEN_IN_LANDSCAPE屬性的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onCheckedChanged
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
int controlFlags = player.getFullscreenControlFlags();
if (isChecked) {
// If you use the FULLSCREEN_FLAG_ALWAYS_FULLSCREEN_IN_LANDSCAPE, your activity's normal UI
// should never be laid out in landscape mode (since the video will be fullscreen whenever the
// activity is in landscape orientation). Therefore you should set the activity's requested
// orientation to portrait. Typically you would do this in your AndroidManifest.xml, we do it
// programmatically here since this activity demos fullscreen behavior both with and without
// this flag).
setRequestedOrientation(PORTRAIT_ORIENTATION);
controlFlags |= YouTubePlayer.FULLSCREEN_FLAG_ALWAYS_FULLSCREEN_IN_LANDSCAPE;
} else {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR);
controlFlags &= ~YouTubePlayer.FULLSCREEN_FLAG_ALWAYS_FULLSCREEN_IN_LANDSCAPE;
}
player.setFullscreenControlFlags(controlFlags);
}
示例2: onInitializationSuccess
@Override
public void onInitializationSuccess(YouTubePlayer.Provider provider,
YouTubePlayer youTubePlayer, boolean wasRestored) {
// Set up YouTube player
mYouTubePlayer = youTubePlayer;
mYouTubePlayer.setPlayerStateChangeListener(this);
mYouTubePlayer.setFullscreen(mIsFullscreen);
mYouTubePlayer.setOnFullscreenListener(this);
// YouTube player flags: use a custom full screen layout; let the YouTube player control
// the system UI (hiding navigation controls, ActionBar etc); and let the YouTube player
// handle the orientation state of the activity.
mYouTubeFullscreenFlags = YouTubePlayer.FULLSCREEN_FLAG_CUSTOM_LAYOUT |
YouTubePlayer.FULLSCREEN_FLAG_CONTROL_SYSTEM_UI |
YouTubePlayer.FULLSCREEN_FLAG_CONTROL_ORIENTATION;
// On smaller screen devices always switch to full screen in landscape mode
if (!mIsTablet) {
mYouTubeFullscreenFlags |= YouTubePlayer.FULLSCREEN_FLAG_ALWAYS_FULLSCREEN_IN_LANDSCAPE;
}
// Apply full screen flags
mYouTubePlayer.setFullscreenControlFlags(mYouTubeFullscreenFlags);
// Load the requested video
if (!TextUtils.isEmpty(mYouTubeVideoId)) {
mYouTubePlayer.loadVideo(mYouTubeVideoId);
}
}
示例3: onInitializationSuccess
@Override
public void onInitializationSuccess(YouTubePlayer.Provider provider,
YouTubePlayer youTubePlayer, boolean wasRestored) {
// Set up YouTube player
mYouTubePlayer = youTubePlayer;
mYouTubePlayer.setPlayerStateChangeListener(this);
mYouTubePlayer.setFullscreen(mIsFullscreen);
mYouTubePlayer.setOnFullscreenListener(this);
// YouTube player flags: use a custom full screen layout; let the YouTube player control
// the system UI (hiding navigation controls, ActionBar etc); and let the YouTube player
// handle the orientation state of the activity.
mYouTubeFullscreenFlags = YouTubePlayer.FULLSCREEN_FLAG_CUSTOM_LAYOUT |
YouTubePlayer.FULLSCREEN_FLAG_CONTROL_SYSTEM_UI |
YouTubePlayer.FULLSCREEN_FLAG_CONTROL_ORIENTATION;
// On smaller screen devices always switch to full screen in landscape mode
if (!mIsTablet) {
mYouTubeFullscreenFlags |= YouTubePlayer.FULLSCREEN_FLAG_ALWAYS_FULLSCREEN_IN_LANDSCAPE;
}
// Apply full screen flags
setFullscreenFlags();
// If a presentation display is available, set YouTube player style to minimal
if (mPresentation != null) {
mYouTubePlayer.setPlayerStyle(YouTubePlayer.PlayerStyle.MINIMAL);
}
// Load the requested video
if (!TextUtils.isEmpty(mYouTubeVideoId)) {
mYouTubePlayer.loadVideo(mYouTubeVideoId);
}
updatePresentation();
}