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


Java YouTubeIntents类代码示例

本文整理汇总了Java中com.google.android.youtube.player.YouTubeIntents的典型用法代码示例。如果您正苦于以下问题:Java YouTubeIntents类的具体用法?Java YouTubeIntents怎么用?Java YouTubeIntents使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


YouTubeIntents类属于com.google.android.youtube.player包,在下文中一共展示了YouTubeIntents类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: playTrailer

import com.google.android.youtube.player.YouTubeIntents; //导入依赖的package包/类
private void playTrailer(int position) {
	try {
		if (position < 0)
			position = 0;
		else if (position > this.mAdapter.getCount() - 1)
			position = this.mAdapter.getCount() - 1;
		Logger.wtf("System.out", String.valueOf(position));
		Trailer trailer = this.mAdapter.getItem(position);
		Intent intent = YouTubeIntents.createPlayVideoIntentWithOptions(this,
				getVideoId(trailer.getUrl()), true, true);
		startActivity(intent);
	} catch (RuntimeException e) {
		Logger.e("System.out", String.format("%d, %d, %s\n",
				position,
				this.mMovieInfo.getId(),
				this.mMovieInfo.getTitleChinese()),
				e
		);
		throw e;
	}
}
 
开发者ID:enginebai,项目名称:Movie-lol-android,代码行数:22,代码来源:TrailerActivity.java

示例3: 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

示例4: logDeviceInfo

import com.google.android.youtube.player.YouTubeIntents; //导入依赖的package包/类
public static final void logDeviceInfo(Context context) {
	try {
		PackageManager pm = context.getPackageManager();
		PackageInfo pi = pm.getPackageInfo(context.getPackageName(), 0);
		Log.i(LOG_TAG, "Version=" + pi.versionName);
		Log.i(LOG_TAG, "IP Address=" + Utils.getLocalIpAddress());
		Log.i(LOG_TAG, "android.os.Build.VERSION.RELEASE=" + android.os.Build.VERSION.RELEASE);
		Log.i(LOG_TAG, "android.os.Build.VERSION.INCREMENTAL=" + android.os.Build.VERSION.INCREMENTAL);
		Log.i(LOG_TAG, "android.os.Build.DEVICE=" + android.os.Build.DEVICE);
		Log.i(LOG_TAG, "android.os.Build.MODEL=" + android.os.Build.MODEL);
		Log.i(LOG_TAG, "android.os.Build.PRODUCT=" + android.os.Build.PRODUCT);
		Log.i(LOG_TAG, "android.os.Build.MANUFACTURER=" + android.os.Build.MANUFACTURER);
		Log.i(LOG_TAG, "android.os.Build.BRAND=" + android.os.Build.BRAND);
		Log.i(LOG_TAG, "android.os.Build.BRAND=" + android.os.Build.BRAND);
		Log.i(LOG_TAG, "YouTube Version=" + YouTubeIntents.getInstalledYouTubeVersionName(context));
	} catch (Exception e) {
		Log.e(LOG_TAG, "logDeviceInfo", e);
	}
}
 
开发者ID:entertailion,项目名称:Video-Wall,代码行数:20,代码来源:Utils.java

示例5: 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

示例6: onClick

import com.google.android.youtube.player.YouTubeIntents; //导入依赖的package包/类
@Override
public void onClick(View v) {
    Context context = v.getContext();
    if (YouTubeApiServiceUtil.isYouTubeApiServiceAvailable(context).equals(YouTubeInitializationResult.SUCCESS)) {
        Intent intent = YouTubeIntents.createPlayVideoIntentWithOptions(context, mYoutubeUrl, false, false);
        context.startActivity(intent);
    } else {
        context.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.youtube.com/watch?v=" + mYoutubeUrl)));
    }
}
 
开发者ID:mrprona92,项目名称:SecretBrand,代码行数:11,代码来源:OnYoutubeClickListener.java

示例7: 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

示例8: onCreate

import com.google.android.youtube.player.YouTubeIntents; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.intents_demo);

  intentItems = new ArrayList<DemoListViewItem>();
  intentItems.add(new IntentItem("Play Video", IntentType.PLAY_VIDEO));
  intentItems.add(new IntentItem("Open Playlist", IntentType.OPEN_PLAYLIST));
  intentItems.add(new IntentItem("Play Playlist", IntentType.PLAY_PLAYLIST));
  intentItems.add(new IntentItem("Open User", IntentType.OPEN_USER));
  intentItems.add(new IntentItem("Open Channel", IntentType.OPEN_CHANNEL));
  intentItems.add(new IntentItem("Open Search Results", IntentType.OPEN_SEARCH));
  intentItems.add(new IntentItem("Upload Video", IntentType.UPLOAD_VIDEO));

  ListView listView = (ListView) findViewById(R.id.intent_list);
  DemoArrayAdapter adapter =
      new DemoArrayAdapter(this, R.layout.list_item, intentItems);
  listView.setAdapter(adapter);
  listView.setOnItemClickListener(this);

  TextView youTubeVersionText = (TextView) findViewById(R.id.youtube_version_text);
  String version = YouTubeIntents.getInstalledYouTubeVersionName(this);
  if (version != null) {
    String text = String.format(getString(R.string.youtube_currently_installed), version);
    youTubeVersionText.setText(text);
  } else {
    youTubeVersionText.setText(getString(R.string.youtube_not_installed));
  }
}
 
开发者ID:ChiangC,项目名称:FMTech,代码行数:30,代码来源:IntentsDemoActivity.java

示例9: onItemClick

import com.google.android.youtube.player.YouTubeIntents; //导入依赖的package包/类
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
  IntentItem clickedIntentItem = (IntentItem) intentItems.get(position);

  Intent intent;
  switch (clickedIntentItem.type) {
    case PLAY_VIDEO:
      intent = YouTubeIntents.createPlayVideoIntentWithOptions(this, VIDEO_ID, true, false);
      startActivity(intent);
      break;
    case OPEN_PLAYLIST:
      intent = YouTubeIntents.createOpenPlaylistIntent(this, PLAYLIST_ID);
      startActivity(intent);
      break;
    case PLAY_PLAYLIST:
      intent = YouTubeIntents.createPlayPlaylistIntent(this, PLAYLIST_ID);
      startActivity(intent);
      break;
    case OPEN_SEARCH:
      intent = YouTubeIntents.createSearchIntent(this, USER_ID);
      startActivity(intent);
      break;
    case OPEN_USER:
      intent = YouTubeIntents.createUserIntent(this, USER_ID);
      startActivity(intent);
      break;
    case OPEN_CHANNEL:
      intent = YouTubeIntents.createChannelIntent(this, CHANNEL_ID);
      startActivity(intent);
      break;
    case UPLOAD_VIDEO:
      // This will load a picker view in the users' gallery.
      // The upload activity is started in the function onActivityResult.
      intent = new Intent(Intent.ACTION_PICK, null).setType("video/*");
      intent.putExtra(EXTRA_LOCAL_ONLY, true);
      startActivityForResult(intent, SELECT_VIDEO_REQUEST);
      break;
  }
}
 
开发者ID:ChiangC,项目名称:FMTech,代码行数:40,代码来源:IntentsDemoActivity.java

示例10: onActivityResult

import com.google.android.youtube.player.YouTubeIntents; //导入依赖的package包/类
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent returnedIntent) {
  if (resultCode == RESULT_OK) {
    switch (requestCode) {
      case SELECT_VIDEO_REQUEST:
        Intent intent = YouTubeIntents.createUploadIntent(this, returnedIntent.getData());
        startActivity(intent);
        break;
    }
  }
  super.onActivityResult(requestCode, resultCode, returnedIntent);
}
 
开发者ID:ChiangC,项目名称:FMTech,代码行数:13,代码来源:IntentsDemoActivity.java

示例11: 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

示例12: 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

示例13: 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

示例14: onCreate

import com.google.android.youtube.player.YouTubeIntents; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.intents_demo);

  intentItems = new ArrayList<DemoListViewItem>();
  intentItems.add(new IntentItem("Play Video", IntentType.PLAY_VIDEO));
  intentItems.add(new IntentItem("Open Playlist", IntentType.OPEN_PLAYLIST));
  intentItems.add(new IntentItem("Play Playlist", IntentType.PLAY_PLAYLIST));
  intentItems.add(new IntentItem("Open User", IntentType.OPEN_USER));
  intentItems.add(new IntentItem("Open Search Results", IntentType.OPEN_SEARCH));
  intentItems.add(new IntentItem("Upload Video", IntentType.UPLOAD_VIDEO));

  ListView listView = (ListView) findViewById(R.id.intent_list);
  DemoArrayAdapter adapter =
      new DemoArrayAdapter(this, R.layout.list_item, intentItems);
  listView.setAdapter(adapter);
  listView.setOnItemClickListener(this);

  TextView youTubeVersionText = (TextView) findViewById(R.id.youtube_version_text);
  String version = YouTubeIntents.getInstalledYouTubeVersionName(this);
  if (version != null) {
    String text = String.format(getString(R.string.youtube_currently_installed), version);
    youTubeVersionText.setText(text);
  } else {
    youTubeVersionText.setText(getString(R.string.youtube_not_installed));
  }
}
 
开发者ID:youtube,项目名称:yt-android-player,代码行数:29,代码来源:IntentsDemoActivity.java

示例15: onItemClick

import com.google.android.youtube.player.YouTubeIntents; //导入依赖的package包/类
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
  IntentItem clickedIntentItem = (IntentItem) intentItems.get(position);

  Intent intent;
  switch (clickedIntentItem.type) {
    case PLAY_VIDEO:
      intent = YouTubeIntents.createPlayVideoIntentWithOptions(this, VIDEO_ID, true, false);
      startActivity(intent);
      break;
    case OPEN_PLAYLIST:
      intent = YouTubeIntents.createOpenPlaylistIntent(this, PLAYLIST_ID);
      startActivity(intent);
      break;
    case PLAY_PLAYLIST:
      intent = YouTubeIntents.createPlayPlaylistIntent(this, PLAYLIST_ID);
      startActivity(intent);
      break;
    case OPEN_SEARCH:
      intent = YouTubeIntents.createSearchIntent(this, USER_ID);
      startActivity(intent);
      break;
    case OPEN_USER:
      intent = YouTubeIntents.createUserIntent(this, USER_ID);
      startActivity(intent);
      break;
    case UPLOAD_VIDEO:
      // This will load a picker view in the users' gallery.
      // The upload activity is started in the function onActivityResult.
      intent = new Intent(Intent.ACTION_PICK, null).setType("video/*");
      intent.putExtra(EXTRA_LOCAL_ONLY, true);
      startActivityForResult(intent, SELECT_VIDEO_REQUEST);
      break;
  }
}
 
开发者ID:youtube,项目名称:yt-android-player,代码行数:36,代码来源:IntentsDemoActivity.java


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