Używam YouTubePlayer (API YouTube dla Androida) wewnątrz Fragment jestem pompowania LinearLayout z YouTube Player, w ten sposób:Android YouTubePlayer z nieuprawnionym nakładki na górze odtwarzacza
fragmentManager = getActivity().getSupportFragmentManager();
fragmentTransaction = fragmentManager.beginTransaction();
player = new YouTubePlayerSupportFragment();
fragmentTransaction.add(R.id.youTubePlayerContainer, player);
fragmentTransaction.commit();
.. .W przypadku You TubePlayerContainer jest zawyżony LinearLayout
Odtwarzacz zostanie wykryty poprawnie, zacznie grać i będzie zatrzymywał się na sekundę. Rejestr zawiera następujące elementy:
YouTube video playback stopped due to unauthorized overlay on top of player.
The YouTubePlayerView is obscured by [email protected]
YouTubePlayerView is completely covered, with the distance in px between each edge of the obscuring view and the YouTubePlayerView being: left: 484, top: 100, right: 100, bottom: 170..
To jest mój XML: (Nie FrameLayout w nim)
<LinearLayout
android:id="@+id/curtain"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<LinearLayout
android:id="@+id/withApi"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<LinearLayout
android:id="@+id/youTubePlayerContainer"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_gravity="center"
android:layout_margin="30dp"
android:layout_weight="1"
android:orientation="vertical" >
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="3dp"
android:background="@color/trans_popUp"
android:padding="3dp" >
<TextView
android:id="@+id/textYouTubeVisor"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Title..."
android:textColor="@color/white" />
</LinearLayout>
</LinearLayout>
Próbowałem zmianę marginesów bez powodzenia. czytam oficjalnej dokumentacji, ale bez powodzenia Wskazuje, że FrameLayout że przyczyną problemu jest: android.widget.FrameLayout @ 4110d1f8 Ale z takiego odniesienia nie identyfikuje który odnosi
komuś, że to się stało?
Doceniam każdą pomoc.
Pozdrowienia
Odtwarzacz został zaprojektowany w taki sposób, aby nie można było niczego umieścić nad zawartością lub elementami sterującymi. Ponieważ nie uwzględniłeś odtwarzacza w swoim układzie, mogę tylko założyć, że układ pojawia się nad wideo, a nie pod nim. Czy widzisz swój tytuł ... podczas gry? –
Czy rozwiązałeś problem? Plz dał mi znać, utknąłem tutaj :( – Reyjohn
@Reyjhon Nie udało mi się rozwiązać tego problemu.Jeżeli znajdę rozwiązanie, wyjaśnię, jeśli znajdziesz, będę wdzięczny za poinformowanie mnie. Pozdrowienia – Sergio76