nathan
nathan

Reputation: 477

YouTube Player not working with a Transparent Panel Menu Android

The YouTube Player will play videos no problem either without the transparent panel on the form or it will play them in full screen, the transparent panel has some images in it nothing special. If I take out the transparent panel, the YouTube Player works as desired, embedded in app. If I add the transparent panel to the form, this is when it will not play but in full screen. The video starts and then stops instantly. I assume it has something to do with the transparent panel but I can not understand what is happening. Any help or thoughts would be great. My java file does not change except for the initPopup would not be there. Shortened Java file version below.

XML Layout File Below:

   <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/mlayout"
android:layout_width="fill_parent" android:layout_height="fill_parent">
    <RelativeLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" >

        <com.google.android.youtube.player.YouTubePlayerView
            android:id="@+id/youtube_view"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:layout_below="@+id/spnrPSA" >
        </com.google.android.youtube.player.YouTubePlayerView>
    </RelativeLayout>

<com.TransparentPanel
    android:id="@+id/popup_window"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:layout_gravity="bottom"
    android:gravity="left"
    android:orientation="vertical"
    android:padding="1px" >

<com.TransparentPanel>

</RelativeLayout>

JAVA File Below:

public final class PSA extends YouTubeFailureRecoveryActivity{
   private Animation animShow, animHide;

  private YouTubePlayer player;


@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.psa);
    initPopup();
    }


   private void initPopup() {

    final TransparentPanel popup = (TransparentPanel) findViewById(R.id.popup_window);

    //  Start out with the popup initially hidden.
    popup.setVisibility(View.GONE);

    if (PubVars.ScreenOrientation==0){
        animShow = AnimationUtils.loadAnimation( this, R.anim.popup_show);
        animHide = AnimationUtils.loadAnimation( this, R.anim.popup_hide);
    }      

     if (PubVars.ScreenOrientation==1){
         animShow = AnimationUtils.loadAnimation( this, R.anim.l_popup_show);
         animHide = AnimationUtils.loadAnimation( this, R.anim.l_popup_hide);
     }
    //animShow = AnimationUtils.loadAnimation( this, R.anim.popup_show);
    //animHide = AnimationUtils.loadAnimation( this, R.anim.popup_hide);

    final ImageView   showButton = (ImageView) findViewById(R.id.show_popup_button);
    final ImageView   hideButton = (ImageView) findViewById(R.id.hide_popup_button);
    showButton.setOnClickListener(new View.OnClickListener() {
        public void onClick(View view) {
            popup.setVisibility(View.VISIBLE);
            popup.startAnimation( animShow );
            showButton.setEnabled(false);
            hideButton.setEnabled(true);
    }});

    hideButton.setOnClickListener(new View.OnClickListener() {
        public void onClick(View view) {
            popup.startAnimation( animHide );
            showButton.setEnabled(true);
            hideButton.setEnabled(false);
            popup.setVisibility(View.GONE);
    }});

     }


 }

I must be missing something simple. Thanks in advance, I am fairly new to android.

Upvotes: 0

Views: 691

Answers (2)

Bruno Donath
Bruno Donath

Reputation: 103

Youtube Player View does not authorize overlays. Even if it's a transparent Layout(Relative, frame, ..). The player stops the video and log into logcat some useful info. But this case is reported as "youtubeplayer is completely covered".

Upvotes: 1

lucasddaniel
lucasddaniel

Reputation: 1789

This api not permit anyone layer over this. "Layout is the problem" I suggest you use the hierarchy View to see this on your layout. I have many problems with it, because my layout stay over a little point over player.

Upvotes: 0

Related Questions