Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Embed config is not supported in RemoteEmbeddedPlayer?

Whenever I'm trying to open Youtube player in my app, onInitializationSuccess() function is always called. But it shows a blank screen.

First this error appears:

W/YouTubeAndroidPlayerAPI: Forcefully created overlay:affq@82a17f5 helper:Lazy@9b7098a view:null status: ....... {...}

and then:

E/YouTubeAndroidPlayerAPI: Embed config is not supported in RemoteEmbeddedPlayer.

Here is my code:

FragmentManager fragmentManager = ((AppCompatActivity)this.context).getSupportFragmentManager();
    FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
    Fragment  youtubeFragment = new YouTubePlayerSupportFragment();
    fragmentManager.beginTransaction().add(R.id.GlideLayout ,youtubeFragment).commit();


    utubevw = (YouTubePlayerSupportFragment) youtubeFragment;
    utubecontainer = imageLayout.findViewById(R.id.youtubecontainer);

    utubecontainer.setVisibility(View.VISIBLE);

    mOnInitializeListener = new YouTubePlayer.OnInitializedListener() {
        @Override
        public void onInitializationSuccess(YouTubePlayer.Provider provider, YouTubePlayer youTubePlayer, boolean b) {
            youTubePlayer.cueVideo("_8kExcHqFi4");
            Log.i("youtube", "Successful");
        }
        @Override
        public void onInitializationFailure(YouTubePlayer.Provider provider, YouTubeInitializationResult youTubeInitializationResult) {
            Log.i("youtube:Fail", youTubeInitializationResult.toString());
        }
    };
    utubevw.initialize(String.valueOf(R.string.googleapikey), mOnInitializeListener);

Searched everywhere, even posted in Github, but couldn't find a solution.

FYI - I don't want to use Webview to play Youtube.

like image 791
bhavya joshi Avatar asked Oct 31 '18 15:10

bhavya joshi


1 Answers

I had the same problem just now and i was able to solve it by removing all possible overlaying views. I had a FAB just closely overlaying the youtube fragment. After moving the FAB away the error was fixed.

like image 78
Peter Ola Avatar answered Oct 17 '22 03:10

Peter Ola