本文整理了Java中com.google.android.youtube.player.YouTubePlayerView.initialize()
方法的一些代码示例,展示了YouTubePlayerView.initialize()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YouTubePlayerView.initialize()
方法的具体详情如下:
包路径:com.google.android.youtube.player.YouTubePlayerView
类名称:YouTubePlayerView
方法名:initialize
暂无
代码示例来源:origin: anitaa1990/TrailersApp
private void initialiseView() {
binding = DataBindingUtil.setContentView(this, R.layout.activity_video);
binding.youtubeView.initialize(AppConstants.YOUTUBE_API_KEY, this);
videoKey = getIntent().getStringExtra(INTENT_VIDEO_KEY);
}
代码示例来源:origin: UdacityAndroidBasicsScholarship/wmn-safety
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_player);
youtube_video_id = getIntent().getExtras().getString("videoID");
youTubePlayerView = findViewById(R.id.youtube_player_view);
youTubePlayerView.initialize(YOUTUBE_API_KEY, this);
}
代码示例来源:origin: narenkukreja/Munch-For-Reddit
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
SwipeBack.attach(this, Position.LEFT)
.setContentView(R.layout.activity_youtube)
.setSwipeBackView(R.layout.swipeback_custom);
Bundle bundle = getIntent().getExtras();
youtubeUrl = bundle.getString("youtube_link");
browserYoutubeUrl = bundle.getString("youtube_link");
if (youtubeUrl.contains("youtube")) {
normalYoutubeUrl = youtubeUrl.substring(youtubeUrl.lastIndexOf("=") + 1);
} else {
normalYoutubeUrl = youtubeUrl.substring(youtubeUrl.lastIndexOf("/") + 1);
}
YouTubePlayerView youTubePlayerView = (YouTubePlayerView) findViewById(R.id.youtube_player);
youTubePlayerView.initialize(API_KEY, this);
}
代码示例来源:origin: msahakyan/nested-recycler-view
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_trailer);
ButterKnife.bind(this);
initTrailerIdFromIntent();
// Initializing video player with developer key
youTubeView.initialize(Config.DEVELOPER_KEY, this);
}
代码示例来源:origin: flipkart-incubator/android-inline-youtube-view
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setFullscreen();
setContentView(R.layout.youtube_player_view);
YouTubePlayerView youTubePlayerView = findViewById(R.id.youtube_player);
String videoId = getVideoId();
String apiKey = getApiKey();
/*
* In case videoId or apiKey is null, throw IllegalStateException as apiKey and videoId is mandatory to run
* youtube activity.
*/
$Precondition$Check.checkArgument(!TextUtils.isEmpty(videoId), " videoId cannot be null");
$Precondition$Check.checkArgument(!TextUtils.isEmpty(apiKey), " apiKey cannot be null");
/*
* In case of YouTube Service not available, fallback to WebView implementation.
*/
if (ServiceUtil.isYouTubeServiceAvailable(this)) {
youTubePlayerView.initialize(apiKey, this);
} else {
String webViewUrl = getWebUrl();
if (!TextUtils.isEmpty(webViewUrl)) {
youTubePlayerView.setVisibility(GONE);
handleWebViewPlayer(videoId, webViewUrl);
} else {
Log.d(TAG, "Web Url is Null");
finish();
}
}
}
内容来源于网络,如有侵权,请联系作者删除!