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


Java YouTubeInitializationResult类代码示例

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


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

示例1: onCreateView

import com.google.android.youtube.player.YouTubeInitializationResult; //导入依赖的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;
}
 
开发者ID:ur13l,项目名称:Guanajoven,代码行数:24,代码来源:AyudaFragment.java

示例2: onStart

import com.google.android.youtube.player.YouTubeInitializationResult; //导入依赖的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();
    }
}
 
开发者ID:wax911,项目名称:anitrend-app,代码行数:26,代码来源:YoutubeFragment.java

示例3: onPostExecute

import com.google.android.youtube.player.YouTubeInitializationResult; //导入依赖的package包/类
@Override
protected void onPostExecute(String result)
{
	if (progressDialog != null)
		progressDialog.dismiss();
    super.onPostExecute(result);	            
	if (result == null) 
 	   Toast.makeText(myself, "Sorry! No video found :(", Toast.LENGTH_SHORT).show();
	else {
    		Intent intent = YouTubeStandalonePlayer.createVideoIntent(
    	         myself , DeveloperKey.DEVELOPER_KEY, result,0, true, false);
    		if (intent == null || !canResolveIntent(intent))
    			YouTubeInitializationResult.SERVICE_MISSING.getErrorDialog(myself, 2).show();
    		else {
    			startTime = System.currentTimeMillis();
    			logger.videoStarted(result, querySong, getDuration(), selectedIndex);
    			startActivity(intent);
    		}
 }    
}
 
开发者ID:ajindal2,项目名称:Youtubemysongs,代码行数:21,代码来源:MainActivity.java

示例4: onActivityResult

import com.google.android.youtube.player.YouTubeInitializationResult; //导入依赖的package包/类
@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);
  }
}
 
开发者ID:sgehrman,项目名称:UTubeTV,代码行数:21,代码来源:DrawerActivity.java

示例5: onInitializationFailure

import com.google.android.youtube.player.YouTubeInitializationResult; //导入依赖的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();
    }
}
 
开发者ID:rishabh115,项目名称:Odyssey2017,代码行数:12,代码来源:YoutubeActivity.java

示例6: onActivityResult

import com.google.android.youtube.player.YouTubeInitializationResult; //导入依赖的package包/类
@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();
        }
    }
}
 
开发者ID:tgbMedia,项目名称:Android-app,代码行数:16,代码来源:OverviewActivity.java

示例7: onInitializationFailure

import com.google.android.youtube.player.YouTubeInitializationResult; //导入依赖的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();
    }
}
 
开发者ID:DameMatiku,项目名称:damematiku-android,代码行数:11,代码来源:YouTubeFailureRecoveryActivity.java

示例8: onInitializationFailure

import com.google.android.youtube.player.YouTubeInitializationResult; //导入依赖的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();
    }
}
 
开发者ID:rahulmaddineni,项目名称:Stayfit,代码行数:10,代码来源:Fragment2.java

示例9: onClick

import com.google.android.youtube.player.YouTubeInitializationResult; //导入依赖的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

示例10: showYouTubeVideo

import com.google.android.youtube.player.YouTubeInitializationResult; //导入依赖的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

示例11: onInitializationFailure

import com.google.android.youtube.player.YouTubeInitializationResult; //导入依赖的package包/类
@Override
public void onInitializationFailure(YouTubePlayer.Provider provider, YouTubeInitializationResult errorReason) {
    if (errorReason.isUserRecoverableError()) {
        errorReason.getErrorDialog(this, RECOVERY_REQUEST).show();
    } else {
        String error = String.format("player error!", errorReason.toString());
        Toast.makeText(this, error, Toast.LENGTH_LONG).show();
    }
}
 
开发者ID:applicaster,项目名称:rn-youtube-android,代码行数:10,代码来源:YoutubePlayerActivity.java

示例12: onInitializationFailure

import com.google.android.youtube.player.YouTubeInitializationResult; //导入依赖的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();
    }
}
 
开发者ID:SEA2015-GROUP7,项目名称:projectTetViet,代码行数:13,代码来源:YouTubePlayerActivity.java

示例13: onInitializationFailure

import com.google.android.youtube.player.YouTubeInitializationResult; //导入依赖的package包/类
@Override
public void onInitializationFailure(YouTubePlayer.Provider provider, YouTubeInitializationResult youTubeInitializationResult) {
    if (youTubeInitializationResult.isUserRecoverableError()) {
        youTubeInitializationResult.getErrorDialog(getActivity(), RECOVERY_DIALOG_REQUEST).show();
    } else {
        Toast.makeText(getActivity(), "The Youtube Player could'nt be initialized", Toast.LENGTH_LONG).show();
    }
}
 
开发者ID:muddassir235,项目名称:Pop-Movies-Android-App,代码行数:9,代码来源:YoutubeFailureRecoveryFragment.java

示例14: onInitializationFailure

import com.google.android.youtube.player.YouTubeInitializationResult; //导入依赖的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();
        }
    }
}
 
开发者ID:ganesh2shiv,项目名称:yt-channel-list-android,代码行数:11,代码来源:YoutubePlayerFragment.java

示例15: onClick

import com.google.android.youtube.player.YouTubeInitializationResult; //导入依赖的package包/类
@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);
  } else if (v == playVideoListButton) {
    intent = YouTubeStandalonePlayer.createVideosIntent(this, DeveloperKey.DEVELOPER_KEY,
        VIDEO_IDS, 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();
    }
  }
}
 
开发者ID:ChiangC,项目名称:FMTech,代码行数:31,代码来源:StandalonePlayerDemoActivity.java


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