當前位置: 首頁>>代碼示例>>Java>>正文


Java YouTubePlayerActivity類代碼示例

本文整理匯總了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);
  }
 
開發者ID:rakshitsoni02,項目名稱:newsApp,代碼行數:28,代碼來源:ContentFragment.java

示例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);
    }
 
開發者ID:SEA2015-GROUP7,項目名稱:projectTetViet,代碼行數:28,代碼來源:VideosActivity.java


注:本文中的com.thefinestartist.ytpa.YouTubePlayerActivity類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。