YouTubePlayerSupportFragment

YouTubePlayerSupportFragment

本文介绍了YouTubePlayerSupportFragment显示网络错误400的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

YouTubePlayerSupportFragment显示网络错误400

YouTubePlayerSupportFragment shows Network error 400

我已经创建了一个小型演示来测试YoutubeSupportFragment

I have created small demo to test YoutubeSupportFragment

 YouTubePlayerSupportFragment youtube_player_fragment = new YouTubePlayerSupportFragment();
        youtube_player_fragment.initialize(DEVELOPER_KEY, new YouTubePlayer.OnInitializedListener() {
            @Override
            public void onInitializationSuccess(YouTubePlayer.Provider provider, YouTubePlayer youTubePlayer, boolean b) {
                if (null == youTubePlayer) return;
                if (!b) {
                    youTubePlayer.setPlayerStyle(YouTubePlayer.PlayerStyle.DEFAULT);
                    youTubePlayer.cuePlaylist("zuf8A0udHrs");


                }
            }

            @Override
            public void onInitializationFailure(YouTubePlayer.Provider provider, YouTubeInitializationResult youTubeInitializationResult) {

            }
        });
        FrameLayout youtube_player_frame = (FrameLayout)findViewById(R.id.youtube_player_frame);
        FragmentManager fragmentManager = getSupportFragmentManager();
        FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
        fragmentTransaction.replace(R.id.youtube_player_frame, youtube_player_fragment);
        fragmentTransaction.commit();

main.xml

 <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" android:layout_width="match_parent"
    android:layout_height="match_parent">
    <FrameLayout
        android:id="@+id/youtube_player_frame"
        android:layout_width="match_parent"
        android:layout_height="190dp"/>
</LinearLayout>

屏幕截图:

推荐答案

您甚至可以连接互联网吗?也许尝试使用另一部电话,因为您在那里处于漫游模式,也许在那里不起作用?

Do you even have an internet connection ?Maybe try on another phone because there you are in Roaming mode maybe it doesnt work in there ?

这篇关于YouTubePlayerSupportFragment显示网络错误400的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-16 04:42