且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如果用户未安装***应用,如何在Android应用中播放***视频?

更新时间:2023-09-21 20:06:58

使用

Use the ***Intents class in the Android Player API to gracefully degrade. Here's some sample code to detect what the user can do:

if(***Intents.is***Installed(context)) {
   if(***ApiServiceUtil.is***ApiServiceAvailable(context) == ***InitializationResult.SUCCESS) {
   // start the *** player
   context.startActivity(
   ***StandalonePlayer.createVideoIntent((Activity) context, "developer_key", videoId));
 } else if(***Intents.canResolvePlayVideoIntent(context)) {
   // Start an intent to the *** app
   context.startActivity(
   ***Intents.createPlayVideoIntent(context, videoId));
 }
}
// Falls through: last resort - render a webview with an iframe

如果您好奇的话,我们会在我们从2013年开始的Google I/O对话中逐步介绍此代码.从6:17左右开始.

We walk through this code in our Google I/O talk from 2013, if you're curious. Start from around 6:17.