本文整理匯總了Java中com.thefinestartist.ytpa.YouTubePlayerActivity類的典型用法代碼示例。如果您正苦於以下問題:Java YouTubePlayerActivity類的具體用法?Java YouTubePlayerActivity怎麽用?Java YouTubePlayerActivity使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
YouTubePlayerActivity類屬於com.thefinestartist.ytpa包,在下文中一共展示了YouTubePlayerActivity類的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: startYoutubeVideo
import com.thefinestartist.ytpa.YouTubePlayerActivity; //導入依賴的package包/類
private void startYoutubeVideo() {
Intent intent = new Intent(getActivity(), YouTubePlayerActivity.class);
String vidoeId = YouTubeUrlParser.getVideoId(youtubeUrl);
// Youtube video ID (Required, You can use YouTubeUrlParser to parse Video Id from url)
intent.putExtra(YouTubePlayerActivity.EXTRA_VIDEO_ID, vidoeId);
// Youtube player style (DEFAULT as default)
intent.putExtra(YouTubePlayerActivity.EXTRA_PLAYER_STYLE, YouTubePlayer.PlayerStyle.DEFAULT);
// Screen Orientation Setting (AUTO for default)
// AUTO, AUTO_START_WITH_LANDSCAPE, ONLY_LANDSCAPE, ONLY_PORTRAIT
intent.putExtra(YouTubePlayerActivity.EXTRA_ORIENTATION, Orientation.AUTO);
// Show audio interface when user adjust volume (true for default)
intent.putExtra(YouTubePlayerActivity.EXTRA_SHOW_AUDIO_UI, true);
// If the video is not playable, use Youtube app or Internet Browser to play it
// (true for default)
intent.putExtra(YouTubePlayerActivity.EXTRA_HANDLE_ERROR, true);
// Animation when closing youtubeplayeractivity (none for default)
intent.putExtra(YouTubePlayerActivity.EXTRA_ANIM_ENTER, R.anim.fade_in);
intent.putExtra(YouTubePlayerActivity.EXTRA_ANIM_EXIT, R.anim.fade_out);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
}
示例2: openYoutubePlayer
import com.thefinestartist.ytpa.YouTubePlayerActivity; //導入依賴的package包/類
private void openYoutubePlayer(String youUrl){
Intent intent = new Intent(VideosActivity.this, YouTubePlayerActivity.class);
// Youtube video ID (Required, You can use YouTubeUrlParser to parse Video Id from url)
intent.putExtra(YouTubePlayerActivity.EXTRA_VIDEO_ID, "iS1g8G_njx8");
// Youtube player style (DEFAULT as default)
intent.putExtra(YouTubePlayerActivity.EXTRA_PLAYER_STYLE, YouTubePlayer.PlayerStyle.DEFAULT);
// Screen Orientation Setting (AUTO for default)
// AUTO, AUTO_START_WITH_LANDSCAPE, ONLY_LANDSCAPE, ONLY_PORTRAIT
intent.putExtra(YouTubePlayerActivity.EXTRA_ORIENTATION, Orientation.AUTO);
// Show audio interface when user adjust volume (true for default)
intent.putExtra(YouTubePlayerActivity.EXTRA_SHOW_AUDIO_UI, true);
// If the video is not playable, use Youtube app or Internet Browser to play it
// (true for default)
intent.putExtra(YouTubePlayerActivity.EXTRA_HANDLE_ERROR, true);
// Animation when closing youtubeplayeractivity (none for default)
// intent.putExtra(YouTubePlayerActivity.EXTRA_ANIM_ENTER, R.anim.fade_in);
// intent.putExtra(YouTubePlayerActivity.EXTRA_ANIM_EXIT, R.anim.fade_out);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
}