com.google.android.youtube.player.YouTubeInitializationResult Java Examples
The following examples show how to use
com.google.android.youtube.player.YouTubeInitializationResult.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DrawerActivity.java From UTubeTV with The Unlicense | 6 votes |
@Override public void onActivityResult(int requestCode, int resultCode, Intent data) { switch (requestCode) { // called when playing a movie, could fail and this dialog shows the user how to fix it case YouTubeAPI.REQ_PLAYER_CODE: if (resultCode != RESULT_OK) { YouTubeInitializationResult errorReason = YouTubeStandalonePlayer.getReturnedInitializationResult(data); if (errorReason.isUserRecoverableError()) { errorReason.getErrorDialog(this, 0).show(); } else { String errorMessage = String.format("PLAYER ERROR!! - %s", errorReason.toString()); Utils.toast(this, errorMessage); } } break; default: super.onActivityResult(requestCode, resultCode, data); } }
Example #2
Source File: YouTubeStandaloneModule.java From react-native-youtube with MIT License | 6 votes |
private void play(final Intent intent, final Promise promise) { Activity currentActivity = getCurrentActivity(); if (currentActivity == null) { promise.reject(E_ACTIVITY_DOES_NOT_EXIST, "Activity doesn't exist"); return; } // Store the promise to resolve/reject when picker returns data mPickerPromise = promise; try { if (intent != null) { if (canResolveIntent(intent)) { currentActivity.startActivityForResult(intent, REQ_START_STANDALONE_PLAYER); } else { // Could not resolve the intent - must need to install or update the YouTube API service. YouTubeInitializationResult.SERVICE_MISSING .getErrorDialog(currentActivity, REQ_RESOLVE_SERVICE_MISSING).show(); } } } catch (Exception e) { mPickerPromise.reject(E_FAILED_TO_SHOW_PLAYER, e); mPickerPromise = null; } }
Example #3
Source File: YouTubeStandaloneModule.java From react-native-youtube with MIT License | 6 votes |
@Override public void onActivityResult(Activity activity, int requestCode, int resultCode, Intent intent) { if (requestCode == REQ_START_STANDALONE_PLAYER) { if (mPickerPromise != null) { if (resultCode != Activity.RESULT_OK) { YouTubeInitializationResult errorReason = YouTubeStandalonePlayer.getReturnedInitializationResult(intent); if (errorReason.isUserRecoverableError()) { errorReason.getErrorDialog(activity, requestCode).show(); mPickerPromise.reject(E_PLAYER_ERROR); } else { String errorMessage = String.format("There was an error initializing the YouTubePlayer (%1$s)", errorReason.toString()); mPickerPromise.reject(E_PLAYER_ERROR, errorMessage); } } else { mPickerPromise.resolve(null); } mPickerPromise = null; } } }
Example #4
Source File: PlayerActivity.java From FlutterYoutube with Apache License 2.0 | 5 votes |
@Override public void onInitializationFailure(Provider provider, YouTubeInitializationResult errorReason) { if (errorReason.isUserRecoverableError()) { errorReason.getErrorDialog(this, RECOVERY_REQUEST).show(); } else { String error = String.format(getString(R.string.player_error), errorReason.toString()); Toast.makeText(this, error, Toast.LENGTH_LONG).show(); } }
Example #5
Source File: YouTubePlayerController.java From react-native-youtube with MIT License | 5 votes |
@Override public void onInitializationFailure(YouTubePlayer.Provider provider, YouTubeInitializationResult result) { if (result.isUserRecoverableError()) { result.getErrorDialog(mYouTubeView.getReactContext().getCurrentActivity(), 0).show(); } mYouTubeView.receivedError(result.toString()); }
Example #6
Source File: StandalonePlayerDemoActivity.java From yt-android-player with Apache License 2.0 | 5 votes |
@Override public void onClick(View v) { int startIndex = parseInt(startIndexEditText.getText().toString(), 0); int startTimeMillis = parseInt(startTimeEditText.getText().toString(), 0) * 1000; boolean autoplay = autoplayCheckBox.isChecked(); boolean lightboxMode = lightboxModeCheckBox.isChecked(); Intent intent = null; if (v == playVideoButton) { intent = YouTubeStandalonePlayer.createVideoIntent( this, DeveloperKey.DEVELOPER_KEY, VIDEO_ID, startTimeMillis, autoplay, lightboxMode); } else if (v == playPlaylistButton) { intent = YouTubeStandalonePlayer.createPlaylistIntent(this, DeveloperKey.DEVELOPER_KEY, PLAYLIST_ID, startIndex, startTimeMillis, autoplay, lightboxMode); } if (intent != null) { if (canResolveIntent(intent)) { startActivityForResult(intent, REQ_START_STANDALONE_PLAYER); } else { // Could not resolve the intent - must need to install or update the YouTube API service. YouTubeInitializationResult.SERVICE_MISSING .getErrorDialog(this, REQ_RESOLVE_SERVICE_MISSING).show(); } } }
Example #7
Source File: StandalonePlayerDemoActivity.java From yt-android-player with Apache License 2.0 | 5 votes |
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == REQ_START_STANDALONE_PLAYER && resultCode != RESULT_OK) { YouTubeInitializationResult errorReason = YouTubeStandalonePlayer.getReturnedInitializationResult(data); if (errorReason.isUserRecoverableError()) { errorReason.getErrorDialog(this, 0).show(); } else { String errorMessage = String.format(getString(R.string.error_player), errorReason.toString()); Toast.makeText(this, errorMessage, Toast.LENGTH_LONG).show(); } } }
Example #8
Source File: VideoWallDemoActivity.java From yt-android-player with Apache License 2.0 | 5 votes |
@Override public void onInitializationFailure( YouTubeThumbnailView thumbnailView, YouTubeInitializationResult errorReason) { if (errorReason.isUserRecoverableError()) { if (errorDialog == null || !errorDialog.isShowing()) { errorDialog = errorReason.getErrorDialog(this, RECOVERY_DIALOG_REQUEST); errorDialog.show(); } } else { String errorMessage = String.format(getString(R.string.error_thumbnail_view), errorReason.toString()); Toast.makeText(this, errorMessage, Toast.LENGTH_LONG).show(); } }
Example #9
Source File: Fragment3.java From Stayfit with Apache License 2.0 | 5 votes |
@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(); } }
Example #10
Source File: Fragment1.java From Stayfit with Apache License 2.0 | 5 votes |
@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(); } }
Example #11
Source File: Fragment2.java From Stayfit with Apache License 2.0 | 5 votes |
@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(); } }
Example #12
Source File: VideoWallDemoActivity.java From yt-android-player with Apache License 2.0 | 5 votes |
@Override public void onInitializationFailure( YouTubePlayer.Provider provider, YouTubeInitializationResult errorReason) { if (errorReason.isUserRecoverableError()) { if (errorDialog == null || !errorDialog.isShowing()) { errorDialog = errorReason.getErrorDialog(this, RECOVERY_DIALOG_REQUEST); errorDialog.show(); } } else { String errorMessage = String.format(getString(R.string.error_player), errorReason.toString()); Toast.makeText(this, errorMessage, Toast.LENGTH_LONG).show(); } }
Example #13
Source File: YouTubeFailureRecoveryActivity.java From yt-android-player with Apache License 2.0 | 5 votes |
@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(); } }
Example #14
Source File: YouTubeFragment.java From android-inline-youtube-view with Apache License 2.0 | 5 votes |
@Override public void onInitializationFailure(YouTubePlayer.Provider provider, YouTubeInitializationResult result) { youTubePlayer = null; if (listener != null) { listener.onInitializationFailure(result.name()); } }
Example #15
Source File: VideoListDemoActivity.java From yt-android-player with Apache License 2.0 | 4 votes |
@Override public void onInitializationFailure( YouTubeThumbnailView view, YouTubeInitializationResult loader) { view.setImageResource(R.drawable.no_thumbnail); }
Example #16
Source File: VideoListDemoActivity.java From yt-android-player with Apache License 2.0 | 4 votes |
@Override public void onInitializationFailure(Provider provider, YouTubeInitializationResult result) { this.player = null; }
Example #17
Source File: CourseUnitYoutubePlayerFragment.java From edx-app-android with Apache License 2.0 | 4 votes |
@Override public void onInitializationFailure(YouTubePlayer.Provider provider, YouTubeInitializationResult result) { redirectToYoutubeDialog(); }
Example #18
Source File: YoutubePlayerDialog.java From Android-SDK with MIT License | 4 votes |
@Override public void onInitializationFailure( YouTubeThumbnailView view, YouTubeInitializationResult loader) { errorText.setText("Error while loading video"); }
Example #19
Source File: YoutubeOverlayFragment.java From AndroidYoutubeOverlay with MIT License | 4 votes |
@Override public void onInitializationFailure(YouTubePlayer.Provider provider, YouTubeInitializationResult result) { LogHelper.logMessage("onInitializationFailure:" + result.name()); this.player = null; }
Example #20
Source File: BasicPlayerActivity.java From YouTubePlayerView-Example with Apache License 2.0 | 4 votes |
@Override public void onInitializationFailure(Provider provider, YouTubeInitializationResult result) { Toast.makeText(this, "Failed to initialize.", Toast.LENGTH_LONG).show(); }
Example #21
Source File: MinimalPlayerActivity.java From YouTubePlayerView-Example with Apache License 2.0 | 4 votes |
@Override public void onInitializationFailure(Provider provider, YouTubeInitializationResult result) { Toast.makeText(this, "Failed to initialize.", Toast.LENGTH_LONG).show(); }
Example #22
Source File: CustomPlayerControlActivity.java From YouTubePlayerView-Example with Apache License 2.0 | 4 votes |
@Override public void onInitializationFailure(Provider provider, YouTubeInitializationResult result) { Toast.makeText(this, "Failed to initialize.", Toast.LENGTH_LONG).show(); }
Example #23
Source File: PlayerActivity.java From search-youtube with Apache License 2.0 | 4 votes |
@Override public void onInitializationFailure(Provider provider, YouTubeInitializationResult result) { Toast.makeText(this, getString(R.string.failed), Toast.LENGTH_LONG).show(); }
Example #24
Source File: YouTubeActivity.java From android-inline-youtube-view with Apache License 2.0 | 4 votes |
@Override public void onInitializationFailure(YouTubePlayer.Provider provider, YouTubeInitializationResult result) { this.youTubePlayer = null; }
Example #25
Source File: PlayerActivity.java From wmn-safety with MIT License | 4 votes |
@Override public void onInitializationFailure(YouTubePlayer.Provider provider, YouTubeInitializationResult youTubeInitializationResult) { if (youTubeInitializationResult.isUserRecoverableError()){ youTubeInitializationResult.getErrorDialog(this,RECOVERY_REQUEST).show(); } }
Example #26
Source File: ServiceUtil.java From android-inline-youtube-view with Apache License 2.0 | 2 votes |
/** * Check if youtube service is available * * @param context {@link Context} * @return true if present, else false */ public static boolean isYouTubeServiceAvailable(Context context) { return YouTubeIntents.isYouTubeInstalled(context) || YouTubeApiServiceUtil.isYouTubeApiServiceAvailable(context) == YouTubeInitializationResult.SUCCESS; }