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


Java YouTubePlayer.Provider方法代碼示例

本文整理匯總了Java中com.google.android.youtube.player.YouTubePlayer.Provider方法的典型用法代碼示例。如果您正苦於以下問題:Java YouTubePlayer.Provider方法的具體用法?Java YouTubePlayer.Provider怎麽用?Java YouTubePlayer.Provider使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.google.android.youtube.player.YouTubePlayer的用法示例。


在下文中一共展示了YouTubePlayer.Provider方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onCreateView

import com.google.android.youtube.player.YouTubePlayer; //導入方法依賴的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: onInitializationSuccess

import com.google.android.youtube.player.YouTubePlayer; //導入方法依賴的package包/類
@Override
public void onInitializationSuccess(YouTubePlayer.Provider provider,
                                    YouTubePlayer youTubePlayer, boolean wasRestored) {
    if (!wasRestored) {
        if (LOG) {
            Log.v(TAG, "trailerData " + trailerData);
        }
        if (trailerData != null && !trailerData.isEmpty()) {
            Uri uri = trailerData.get(0).getTrailerUri();

            if (LOG) {
                Log.v(TAG, "trailerData " + trailerData.size());
            }
            String trailerCode = uri.getQueryParameter("v");
            if (trailerCode != null) {
                this.youTubePlayer = youTubePlayer;
                youTubePlayer.cueVideo(trailerCode);
            }
        } else {
            getFragmentManager().beginTransaction().remove(youTubePlayerFragment).commit();
        }
    }
}
 
開發者ID:an-garcia,項目名稱:MovieGuide,代碼行數:24,代碼來源:TVShowActivity.java

示例3: onInitializationSuccess

import com.google.android.youtube.player.YouTubePlayer; //導入方法依賴的package包/類
@Override
public void onInitializationSuccess(YouTubePlayer.Provider provider, YouTubePlayer player, boolean wasRestored) {
    if (!_screenEnabled) {
        return;
    }

    if (!_youTubePlayerIsInitialized) {
        _youtubePlayer = player;

        _youtubePlayer.setPlayerStateChangeListener(_playerStateChangeListener);
        _youtubePlayer.setPlaybackEventListener(_playbackEventListener);

        _youTubePlayerIsInitialized = true;
    }

    if (!wasRestored) {
        startVideo(_youtubeId);
    }
}
 
開發者ID:GuepardoApps,項目名稱:LucaHome-AndroidApplication,代碼行數:20,代碼來源:CenterViewController.java

示例4: onStart

import com.google.android.youtube.player.YouTubePlayer; //導入方法依賴的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

示例5: onInitializationSuccess

import com.google.android.youtube.player.YouTubePlayer; //導入方法依賴的package包/類
@Override
public void onInitializationSuccess(YouTubePlayer.Provider provider, final YouTubePlayer player, boolean restored) {
    LogHelper.logMessage("onInitializationSuccess: " + restored + " videoId: " + videoId);
    this.player = player;
    player.addFullscreenControlFlag(YouTubePlayer.FULLSCREEN_FLAG_CONTROL_SYSTEM_UI);
    player.addFullscreenControlFlag(YouTubePlayer.FULLSCREEN_FLAG_CUSTOM_LAYOUT);
    player.setOnFullscreenListener(new YouTubePlayer.OnFullscreenListener() {

        @Override
        public void onFullscreen(boolean fullscreen) {
            YoutubeOverlayFragment.this.fullscreen = fullscreen;
        }
    });
    if (!restored && videoId != null) {
        player.loadVideo(videoId);
    }
}
 
開發者ID:jszczygiel,項目名稱:AndroidYoutubeOverlay,代碼行數:18,代碼來源:YoutubeOverlayFragment.java

示例6: onInitializationSuccess

import com.google.android.youtube.player.YouTubePlayer; //導入方法依賴的package包/類
@Override
public void onInitializationSuccess(YouTubePlayer.Provider provider, YouTubePlayer youTubePlayer, boolean b) {
    this.player = youTubePlayer;
    player.setOnFullscreenListener(this);
    player.setPlayerStateChangeListener(this);
    player.setFullscreenControlFlags(YouTubePlayer.FULLSCREEN_FLAG_CONTROL_ORIENTATION
            | YouTubePlayer.FULLSCREEN_FLAG_CONTROL_SYSTEM_UI
            | YouTubePlayer.FULLSCREEN_FLAG_ALWAYS_FULLSCREEN_IN_LANDSCAPE
            | YouTubePlayer.FULLSCREEN_FLAG_CUSTOM_LAYOUT);

    player.setPlayerStyle(YouTubePlayer.PlayerStyle.DEFAULT);

    if (!b)
        player.loadVideo(videoId);

}
 
開發者ID:slartus,項目名稱:4pdaClient-plus,代碼行數:17,代碼來源:YoutubeActivity.java

示例7: onInitializationSuccess

import com.google.android.youtube.player.YouTubePlayer; //導入方法依賴的package包/類
@Override
public void onInitializationSuccess(YouTubePlayer.Provider provider, YouTubePlayer youTubePlayer, boolean wasRestored)
{
    if (Configuration.ORIENTATION_PORTRAIT == getResources().getConfiguration().orientation) {
        this.youTubePlayer = youTubePlayer;
        youTubePlayer.setFullscreenControlFlags(YouTubePlayer.FULLSCREEN_FLAG_CONTROL_ORIENTATION);
        youTubePlayer.addFullscreenControlFlag(YouTubePlayer.FULLSCREEN_FLAG_CONTROL_SYSTEM_UI);
        youTubePlayer.setShowFullscreenButton(false);
        youTubePlayer.setOnFullscreenListener(new YouTubePlayer.OnFullscreenListener()
        {
            @Override
            public void onFullscreen(boolean b)
            {
                isFullscreen = b;
            }
        });
        if (mVideoId != null && !wasRestored) {
            youTubePlayer.loadVideo(mVideoId);
        }
        if (wasRestored) {
            youTubePlayer.seekToMillis(millis);
        }
    }
}
 
開發者ID:mcruncher,項目名稱:worshipsongs-android,代碼行數:25,代碼來源:CustomYoutubeBoxActivity.java

示例8: onInitializationSuccess

import com.google.android.youtube.player.YouTubePlayer; //導入方法依賴的package包/類
@Override
public void onInitializationSuccess(YouTubePlayer.Provider provider, YouTubePlayer youTubePlayer, boolean wasRestored) {
    player = youTubePlayer;
    youTubePlayer.setFullscreenControlFlags(YouTubePlayer.FULLSCREEN_FLAG_CONTROL_ORIENTATION);
    youTubePlayer.addFullscreenControlFlag(YouTubePlayer.FULLSCREEN_FLAG_CONTROL_SYSTEM_UI);
    youTubePlayer.setOnFullscreenListener(b -> isFullScreen = b);

    if (videoId != null && !wasRestored) {
        youTubePlayer.loadVideo(videoId);
    }

    if (wasRestored) {
        youTubePlayer.seekToMillis(videoTime);
    }
}
 
開發者ID:prakh25,項目名稱:MovieApp,代碼行數:16,代碼來源:TrailerActivity.java

示例9: onInitializationSuccess

import com.google.android.youtube.player.YouTubePlayer; //導入方法依賴的package包/類
@Override
public void onInitializationSuccess(YouTubePlayer.Provider provider, YouTubePlayer youTubePlayer, boolean b) {
    if (!b) {

        // loadVideo() will auto play video
        // Use cueVideo() method, if you don't want to play it automatically
        youTubePlayer.cueVideo(Config.YOUTUBE_VIDEO_CODE);
        player=youTubePlayer;
        // Hiding player controls
        youTubePlayer.setPlayerStyle(YouTubePlayer.PlayerStyle.DEFAULT);
    }
}
 
開發者ID:rishabh115,項目名稱:Odyssey2017,代碼行數:13,代碼來源:YoutubeActivity.java

示例10: onInitializationFailure

import com.google.android.youtube.player.YouTubePlayer; //導入方法依賴的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

示例11: onInitializationFailure

import com.google.android.youtube.player.YouTubePlayer; //導入方法依賴的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

示例12: onInitializationSuccess

import com.google.android.youtube.player.YouTubePlayer; //導入方法依賴的package包/類
@Override
    public void onInitializationSuccess(YouTubePlayer.Provider provider, YouTubePlayer player, boolean wasRestored) {
        if (!wasRestored) {
//            player.cueVideo("wKJ9KzGQq0w");
            player.cueVideo(presenter.getViewId());
        }
    }
 
開發者ID:DameMatiku,項目名稱:damematiku-android,代碼行數:8,代碼來源:VideoActivity.java

示例13: onInitializationFailure

import com.google.android.youtube.player.YouTubePlayer; //導入方法依賴的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

示例14: onInitializationFailure

import com.google.android.youtube.player.YouTubePlayer; //導入方法依賴的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

示例15: onInitializationFailure

import com.google.android.youtube.player.YouTubePlayer; //導入方法依賴的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


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