2
我正在使用YouTubePlayerSuportFragment加載視頻。它不播放當前視頻ID,而是播放以前ID中的視頻。每當我從Android應用程序的設置中清除數據時,YouTubePlayer播放當前的視頻ID。如何忽略或跳過YouTubePlayer上的緩存?YouTube播放器在刷新新視頻ID後播放先前的視頻ID
YouTubePlayerSupportFragment youTubePlayerSupportFragment = YouTubePlayerSupportFragment.newInstance();
FragmentTransaction transaction = getChildFragmentManager().beginTransaction();
transaction.add(R.id.youtube_layout, youTubePlayerSupportFragment).commit();
youTubePlayerSupportFragment.initialize(LinkConfig.API_KEY_ANDROID, new YouTubePlayer.OnInitializedListener() {
@Override
public void onInitializationSuccess(YouTubePlayer.Provider provider, YouTubePlayer youTubePlayer, boolean b) {
youTubePlayer.loadVideo(SplashScreen.mainData.getVod().getCount().getPopular());
youTubePlayer.setPlayerStyle(YouTubePlayer.PlayerStyle.DEFAULT);
youTubePlayer.setShowFullscreenButton(true);
youTubePlayer.setFullscreenControlFlags(YouTubePlayer.FULLSCREEN_FLAG_CONTROL_ORIENTATION | YouTubePlayer.FULLSCREEN_FLAG_ALWAYS_FULLSCREEN_IN_LANDSCAPE);
}
@Override
public void onInitializationFailure(YouTubePlayer.Provider provider, YouTubeInitializationResult youTubeInitializationResult) {
if (youTubeInitializationResult.isUserRecoverableError()) {
youTubeInitializationResult.getErrorDialog(getActivity(), 1).show();
} else {
Toast.makeText(getActivity(), "errorMessage", Toast.LENGTH_LONG).show();
}
}
});