本文整理汇总了Java中com.google.android.youtube.player.YouTubeIntents.canResolvePlayVideoIntent方法的典型用法代码示例。如果您正苦于以下问题:Java YouTubeIntents.canResolvePlayVideoIntent方法的具体用法?Java YouTubeIntents.canResolvePlayVideoIntent怎么用?Java YouTubeIntents.canResolvePlayVideoIntent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.android.youtube.player.YouTubeIntents
的用法示例。
在下文中一共展示了YouTubeIntents.canResolvePlayVideoIntent方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isIntentTypeEnabled
import com.google.android.youtube.player.YouTubeIntents; //导入方法依赖的package包/类
public boolean isIntentTypeEnabled(IntentType type) {
switch (type) {
case PLAY_VIDEO:
return YouTubeIntents.canResolvePlayVideoIntent(this);
case OPEN_PLAYLIST:
return YouTubeIntents.canResolveOpenPlaylistIntent(this);
case PLAY_PLAYLIST:
return YouTubeIntents.canResolvePlayPlaylistIntent(this);
case OPEN_SEARCH:
return YouTubeIntents.canResolveSearchIntent(this);
case OPEN_USER:
return YouTubeIntents.canResolveUserIntent(this);
case OPEN_CHANNEL:
return YouTubeIntents.canResolveChannelIntent(this);
case UPLOAD_VIDEO:
return YouTubeIntents.canResolveUploadIntent(this);
}
return false;
}
示例2: isIntentTypeEnabled
import com.google.android.youtube.player.YouTubeIntents; //导入方法依赖的package包/类
public boolean isIntentTypeEnabled(IntentType type) {
switch (type) {
case PLAY_VIDEO:
return YouTubeIntents.canResolvePlayVideoIntent(this);
case OPEN_PLAYLIST:
return YouTubeIntents.canResolveOpenPlaylistIntent(this);
case PLAY_PLAYLIST:
return YouTubeIntents.canResolvePlayPlaylistIntent(this);
case OPEN_SEARCH:
return YouTubeIntents.canResolveSearchIntent(this);
case OPEN_USER:
return YouTubeIntents.canResolveUserIntent(this);
case UPLOAD_VIDEO:
return YouTubeIntents.canResolveUploadIntent(this);
}
return false;
}
示例3: checkStatus
import com.google.android.youtube.player.YouTubeIntents; //导入方法依赖的package包/类
/**
* Runs once to check if users has youtube installed
*/
private void checkStatus(){
if(!YouTubeIntents.canResolvePlayVideoIntent(this))
{
mPresenter.createSuperToast(MainActivity.this,
getString(R.string.init_youtube_missing),
R.drawable.ic_play_circle_outline_white_24dp,
Style.TYPE_STANDARD, Style.DURATION_VERY_LONG,
PaletteUtils.getSolidColor(PaletteUtils.MATERIAL_BLUE_GREY));
}
}
示例4: showYouTubeVideo
import com.google.android.youtube.player.YouTubeIntents; //导入方法依赖的package包/类
public static void showYouTubeVideo(String videoId, Activity activity) {
if (!TextUtils.isEmpty(videoId)) {
Intent liveIntent;
if (YouTubeIntents.isYouTubeInstalled(activity) && YouTubeApiServiceUtil
.isYouTubeApiServiceAvailable(activity)
== YouTubeInitializationResult.SUCCESS) {
// YouTube service is available.
LOGW(TAG, "YouTube service available.");
// start the YouTube player
liveIntent = YouTubeStandalonePlayer.createVideoIntent(activity,
com.google.samples.apps.iosched.BuildConfig.YOUTUBE_API_KEY, videoId);
} else if (YouTubeIntents.canResolvePlayVideoIntent(activity)) {
// The YouTube app may not be fully up-to-date but it is installed and can resolve
// intents.
LOGW(TAG, "YouTube can resolve the intent.");
// Start an intent to the YouTube app
liveIntent = YouTubeIntents.createPlayVideoIntent(activity, videoId);
} else {
// YouTube may not be installed or it may be disabled.
LOGW(TAG, "Redirecting to a browser.");
liveIntent = new Intent(Intent.ACTION_VIEW);
liveIntent.setData(Uri.parse("https://www.youtube.com/watch?v=" + videoId));
}
activity.startActivity(liveIntent);
} else {
Toast.makeText(activity, R.string.explore_io_video_id_not_valid,
Toast.LENGTH_LONG).show();
}
}
示例5: getWatchLiveIntent
import com.google.android.youtube.player.YouTubeIntents; //导入方法依赖的package包/类
private Intent getWatchLiveIntent(Context context) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP &&
YouTubeIntents.canResolvePlayVideoIntent(context)) {
String youtubeVideoId = SessionLivestreamActivity.getVideoIdFromUrl(mLivestreamUrl);
return YouTubeIntents.createPlayVideoIntentWithOptions(
context, youtubeVideoId, true, false);
}
return new Intent(Intent.ACTION_VIEW, mSessionUri).setClass(context,
SessionLivestreamActivity.class);
}
示例6: showYouTubeVideo
import com.google.android.youtube.player.YouTubeIntents; //导入方法依赖的package包/类
public static void showYouTubeVideo(String videoId, Activity activity) {
if (!TextUtils.isEmpty(videoId)) {
Intent liveIntent;
if (YouTubeIntents.isYouTubeInstalled(activity) && YouTubeApiServiceUtil
.isYouTubeApiServiceAvailable(activity)
== YouTubeInitializationResult.SUCCESS) {
// YouTube service is available.
LOGW(TAG, "YouTube service available.");
// start the YouTube player
liveIntent = YouTubeStandalonePlayer.createVideoIntent(activity,
com.jjcamera.apps.iosched.BuildConfig.YOUTUBE_API_KEY, videoId);
} else if (YouTubeIntents.canResolvePlayVideoIntent(activity)) {
// The YouTube app may not be fully up-to-date but it is installed and can resolve
// intents.
LOGW(TAG, "YouTube can resolve the intent.");
// Start an intent to the YouTube app
liveIntent = YouTubeIntents.createPlayVideoIntent(activity, videoId);
} else {
// YouTube may not be installed or it may be disabled.
LOGW(TAG, "Redirecting to a browser.");
liveIntent = new Intent(Intent.ACTION_VIEW);
liveIntent.setData(Uri.parse("https://www.youtube.com/watch?v=" + videoId));
}
activity.startActivity(liveIntent);
} else {
Toast.makeText(activity, R.string.explore_io_video_id_not_valid,
Toast.LENGTH_LONG).show();
}
}
示例7: getWatchLiveIntent
import com.google.android.youtube.player.YouTubeIntents; //导入方法依赖的package包/类
private Intent getWatchLiveIntent(Context context) {
LPreviewUtilsBase lpu = ((BaseActivity) getActivity()).getLPreviewUtils();
if (lpu.hasLPreviewAPIs() && YouTubeIntents.canResolvePlayVideoIntent(context)) {
String youtubeVideoId = SessionLivestreamActivity.getVideoIdFromUrl(mLivestreamUrl);
return YouTubeIntents.createPlayVideoIntentWithOptions(
context, youtubeVideoId, true, false);
}
return new Intent(Intent.ACTION_VIEW, mSessionUri).setClass(context,
SessionLivestreamActivity.class);
}
示例8: onKeyUp
import com.google.android.youtube.player.YouTubeIntents; //导入方法依赖的package包/类
@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
switch (keyCode) {
case KeyEvent.KEYCODE_DPAD_CENTER:
case KeyEvent.KEYCODE_ENTER: {
if (currentVideoId != null && YouTubeIntents.isYouTubeInstalled(this) && YouTubeIntents.canResolvePlayVideoIntent(this)) {
// open current video in YouTube app
Intent intent = YouTubeIntents.createPlayVideoIntentWithOptions(this, currentVideoId, true, true);
startActivity(intent);
}
return true;
}
case KeyEvent.KEYCODE_MEDIA_STOP:
case KeyEvent.KEYCODE_MEDIA_NEXT: {
if (state.equals(State.VIDEO_PLAYING)) {
if (player != null && player.isPlaying()) {
// end the current playing video
player.seekToMillis(player.getDurationMillis());
}
}
return true;
}
case KeyEvent.KEYCODE_MEDIA_PAUSE: {
if (state.equals(State.VIDEO_PLAYING)) {
if (player != null && player.isPlaying()) {
player.pause();
}
}
return true;
}
case KeyEvent.KEYCODE_MEDIA_PLAY: {
if (state.equals(State.VIDEO_PLAYING)) {
if (player != null && !player.isPlaying()) {
player.play();
}
}
return true;
}
}
return super.onKeyUp(keyCode, event);
}