当前位置: 首页>>代码示例>>Java>>正文


Java YouTubeIntents.canResolvePlayVideoIntent方法代码示例

本文整理汇总了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;
}
 
开发者ID:ChiangC,项目名称:FMTech,代码行数:21,代码来源:IntentsDemoActivity.java

示例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;
}
 
开发者ID:youtube,项目名称:yt-android-player,代码行数:19,代码来源:IntentsDemoActivity.java

示例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));
    }
}
 
开发者ID:wax911,项目名称:anitrend-app,代码行数:14,代码来源:MainActivity.java

示例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();
    }
}
 
开发者ID:silicon-mountain,项目名称:smconf-android,代码行数:30,代码来源:YouTubeUtils.java

示例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);
}
 
开发者ID:The-WebOps-Club,项目名称:saarang-iosched,代码行数:11,代码来源:SessionDetailActivity.java

示例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();
    }
}
 
开发者ID:xunboo,项目名称:JJCamera,代码行数:30,代码来源:YouTubeUtils.java

示例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);
}
 
开发者ID:ramonrabello,项目名称:devfestnorte-app,代码行数:11,代码来源:SessionDetailFragment.java

示例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);
}
 
开发者ID:entertailion,项目名称:Video-Wall,代码行数:43,代码来源:VideoWallActivity.java


注:本文中的com.google.android.youtube.player.YouTubeIntents.canResolvePlayVideoIntent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。