本文整理匯總了Java中com.google.android.youtube.player.YouTubePlayer.Provider方法的典型用法代碼示例。如果您正苦於以下問題:Java YouTubePlayer.Provider方法的具體用法?Java YouTubePlayer.Provider怎麽用?Java YouTubePlayer.Provider使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.google.android.youtube.player.YouTubePlayer
的用法示例。
在下文中一共展示了YouTubePlayer.Provider方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onCreateView
import com.google.android.youtube.player.YouTubePlayer; //導入方法依賴的package包/類
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
super.onCreateView(inflater, container, savedInstanceState);
View v = inflater.inflate(R.layout.fragment_ayuda, container, false);
videoView = (YouTubePlayerFragment) getActivity().getFragmentManager().findFragmentById(R.id.fragment_youtube);
listener = new YouTubePlayer.OnInitializedListener() {
@Override
public void onInitializationSuccess(YouTubePlayer.Provider provider, YouTubePlayer youTubePlayer, boolean b) {
youTubePlayer.loadVideo(getString(R.string.fragment_ayuda_link_video));
youTubePlayer.setShowFullscreenButton(false);
}
@Override
public void onInitializationFailure(YouTubePlayer.Provider provider, YouTubeInitializationResult youTubeInitializationResult) {
}
};
videoView.initialize(getString(R.string.fragment_ayuda_youtubekey), listener);
return v;
}
示例2: onInitializationSuccess
import com.google.android.youtube.player.YouTubePlayer; //導入方法依賴的package包/類
@Override
public void onInitializationSuccess(YouTubePlayer.Provider provider,
YouTubePlayer youTubePlayer, boolean wasRestored) {
if (!wasRestored) {
if (LOG) {
Log.v(TAG, "trailerData " + trailerData);
}
if (trailerData != null && !trailerData.isEmpty()) {
Uri uri = trailerData.get(0).getTrailerUri();
if (LOG) {
Log.v(TAG, "trailerData " + trailerData.size());
}
String trailerCode = uri.getQueryParameter("v");
if (trailerCode != null) {
this.youTubePlayer = youTubePlayer;
youTubePlayer.cueVideo(trailerCode);
}
} else {
getFragmentManager().beginTransaction().remove(youTubePlayerFragment).commit();
}
}
}
示例3: onInitializationSuccess
import com.google.android.youtube.player.YouTubePlayer; //導入方法依賴的package包/類
@Override
public void onInitializationSuccess(YouTubePlayer.Provider provider, YouTubePlayer player, boolean wasRestored) {
if (!_screenEnabled) {
return;
}
if (!_youTubePlayerIsInitialized) {
_youtubePlayer = player;
_youtubePlayer.setPlayerStateChangeListener(_playerStateChangeListener);
_youtubePlayer.setPlaybackEventListener(_playbackEventListener);
_youTubePlayerIsInitialized = true;
}
if (!wasRestored) {
startVideo(_youtubeId);
}
}
示例4: onStart
import com.google.android.youtube.player.YouTubePlayer; //導入方法依賴的package包/類
@Override
public void onStart() {
try {
super.onStart();
initializedListener = new YouTubePlayer.OnInitializedListener() {
@Override
public void onInitializationFailure(YouTubePlayer.Provider provider, YouTubeInitializationResult result) {
}
@Override
public void onInitializationSuccess(YouTubePlayer.Provider provider, YouTubePlayer player, boolean wasRestored) {
if (!wasRestored && stream_link != null) {
player_reference = player;
player_reference.cueVideo(stream_link);
} else if (wasRestored) {
player.seekToMillis(play_position);
}
}
};
init();
} catch (Exception e) {
e.printStackTrace();
}
}
示例5: onInitializationSuccess
import com.google.android.youtube.player.YouTubePlayer; //導入方法依賴的package包/類
@Override
public void onInitializationSuccess(YouTubePlayer.Provider provider, final YouTubePlayer player, boolean restored) {
LogHelper.logMessage("onInitializationSuccess: " + restored + " videoId: " + videoId);
this.player = player;
player.addFullscreenControlFlag(YouTubePlayer.FULLSCREEN_FLAG_CONTROL_SYSTEM_UI);
player.addFullscreenControlFlag(YouTubePlayer.FULLSCREEN_FLAG_CUSTOM_LAYOUT);
player.setOnFullscreenListener(new YouTubePlayer.OnFullscreenListener() {
@Override
public void onFullscreen(boolean fullscreen) {
YoutubeOverlayFragment.this.fullscreen = fullscreen;
}
});
if (!restored && videoId != null) {
player.loadVideo(videoId);
}
}
示例6: onInitializationSuccess
import com.google.android.youtube.player.YouTubePlayer; //導入方法依賴的package包/類
@Override
public void onInitializationSuccess(YouTubePlayer.Provider provider, YouTubePlayer youTubePlayer, boolean b) {
this.player = youTubePlayer;
player.setOnFullscreenListener(this);
player.setPlayerStateChangeListener(this);
player.setFullscreenControlFlags(YouTubePlayer.FULLSCREEN_FLAG_CONTROL_ORIENTATION
| YouTubePlayer.FULLSCREEN_FLAG_CONTROL_SYSTEM_UI
| YouTubePlayer.FULLSCREEN_FLAG_ALWAYS_FULLSCREEN_IN_LANDSCAPE
| YouTubePlayer.FULLSCREEN_FLAG_CUSTOM_LAYOUT);
player.setPlayerStyle(YouTubePlayer.PlayerStyle.DEFAULT);
if (!b)
player.loadVideo(videoId);
}
示例7: onInitializationSuccess
import com.google.android.youtube.player.YouTubePlayer; //導入方法依賴的package包/類
@Override
public void onInitializationSuccess(YouTubePlayer.Provider provider, YouTubePlayer youTubePlayer, boolean wasRestored)
{
if (Configuration.ORIENTATION_PORTRAIT == getResources().getConfiguration().orientation) {
this.youTubePlayer = youTubePlayer;
youTubePlayer.setFullscreenControlFlags(YouTubePlayer.FULLSCREEN_FLAG_CONTROL_ORIENTATION);
youTubePlayer.addFullscreenControlFlag(YouTubePlayer.FULLSCREEN_FLAG_CONTROL_SYSTEM_UI);
youTubePlayer.setShowFullscreenButton(false);
youTubePlayer.setOnFullscreenListener(new YouTubePlayer.OnFullscreenListener()
{
@Override
public void onFullscreen(boolean b)
{
isFullscreen = b;
}
});
if (mVideoId != null && !wasRestored) {
youTubePlayer.loadVideo(mVideoId);
}
if (wasRestored) {
youTubePlayer.seekToMillis(millis);
}
}
}
示例8: onInitializationSuccess
import com.google.android.youtube.player.YouTubePlayer; //導入方法依賴的package包/類
@Override
public void onInitializationSuccess(YouTubePlayer.Provider provider, YouTubePlayer youTubePlayer, boolean wasRestored) {
player = youTubePlayer;
youTubePlayer.setFullscreenControlFlags(YouTubePlayer.FULLSCREEN_FLAG_CONTROL_ORIENTATION);
youTubePlayer.addFullscreenControlFlag(YouTubePlayer.FULLSCREEN_FLAG_CONTROL_SYSTEM_UI);
youTubePlayer.setOnFullscreenListener(b -> isFullScreen = b);
if (videoId != null && !wasRestored) {
youTubePlayer.loadVideo(videoId);
}
if (wasRestored) {
youTubePlayer.seekToMillis(videoTime);
}
}
示例9: onInitializationSuccess
import com.google.android.youtube.player.YouTubePlayer; //導入方法依賴的package包/類
@Override
public void onInitializationSuccess(YouTubePlayer.Provider provider, YouTubePlayer youTubePlayer, boolean b) {
if (!b) {
// loadVideo() will auto play video
// Use cueVideo() method, if you don't want to play it automatically
youTubePlayer.cueVideo(Config.YOUTUBE_VIDEO_CODE);
player=youTubePlayer;
// Hiding player controls
youTubePlayer.setPlayerStyle(YouTubePlayer.PlayerStyle.DEFAULT);
}
}
示例10: onInitializationFailure
import com.google.android.youtube.player.YouTubePlayer; //導入方法依賴的package包/類
@Override
public void onInitializationFailure(YouTubePlayer.Provider provider, YouTubeInitializationResult youTubeInitializationResult) {
if (youTubeInitializationResult.isUserRecoverableError()) {
LogSaver.appendLog(TAG+" :"+youTubeInitializationResult.toString());
youTubeInitializationResult.getErrorDialog(this, RECOVERY_DIALOG_REQUEST).show();
} else {
String errorMessage = String.format(
getString(R.string.error_player), youTubeInitializationResult.toString());
Toast.makeText(this, errorMessage, Toast.LENGTH_LONG).show();
}
}
示例11: onInitializationFailure
import com.google.android.youtube.player.YouTubePlayer; //導入方法依賴的package包/類
@Override
public void onInitializationFailure(YouTubePlayer.Provider provider,
YouTubeInitializationResult errorReason) {
if (errorReason.isUserRecoverableError()) {
errorReason.getErrorDialog(this, RECOVERY_DIALOG_REQUEST).show();
} else {
String errorMessage = String.format(getString(R.string.error_player), errorReason.toString());
Toast.makeText(this, errorMessage, Toast.LENGTH_LONG).show();
}
}
示例12: onInitializationSuccess
import com.google.android.youtube.player.YouTubePlayer; //導入方法依賴的package包/類
@Override
public void onInitializationSuccess(YouTubePlayer.Provider provider, YouTubePlayer player, boolean wasRestored) {
if (!wasRestored) {
// player.cueVideo("wKJ9KzGQq0w");
player.cueVideo(presenter.getViewId());
}
}
示例13: onInitializationFailure
import com.google.android.youtube.player.YouTubePlayer; //導入方法依賴的package包/類
@Override
public void onInitializationFailure(YouTubePlayer.Provider provider,
YouTubeInitializationResult errorReason) {
if (errorReason.isUserRecoverableError()) {
errorReason.getErrorDialog(this, RECOVERY_DIALOG_REQUEST).show();
} else {
String errorMessage = String.format(
"There was an error initializing the YouTubePlayer (%1$s)",
errorReason.toString());
Toast.makeText(this, errorMessage, Toast.LENGTH_LONG).show();
}
}
示例14: onInitializationFailure
import com.google.android.youtube.player.YouTubePlayer; //導入方法依賴的package包/類
@Override
public void onInitializationFailure(YouTubePlayer.Provider provider, YouTubeInitializationResult youTubeInitializationResult) {
if (youTubeInitializationResult.isUserRecoverableError()) {
youTubeInitializationResult.getErrorDialog(getActivity(), RECOVERY_DIALOG_REQUEST).show();
} else {
//Handle the failure
Toast.makeText(getActivity(), "onInitializationFailure", Toast.LENGTH_LONG).show();
}
}
示例15: onInitializationFailure
import com.google.android.youtube.player.YouTubePlayer; //導入方法依賴的package包/類
@Override
public void onInitializationFailure(YouTubePlayer.Provider provider, YouTubeInitializationResult youTubeInitializationResult) {
if (youTubeInitializationResult.isUserRecoverableError()) {
youTubeInitializationResult.getErrorDialog(getActivity(), RECOVERY_DIALOG_REQUEST).show();
} else {
if (isAdded()) {
Toast.makeText(getActivity().getApplicationContext(), getString(R.string.error_init_failure_msg), Toast.LENGTH_SHORT).show();
}
}
}