2017-02-27 64 views
0
YouTube video playback stopped due to unauthorized overlay on top of player. The YouTubePlayerView is obscured by com.google.android.youtube.player.YouTubePlayerView{b5323ed V.E...... ........ 0,0-680,382}. YouTubePlayerView is completely covered, with the distance in px between each edge of the obscuring view and the YouTubePlayerView being: left: 0, top: 0, right: 0, bottom: 0.. 

我已經提到上面我面對我的時候重新初始化新的YouTube視頻網址在YouTube片段錯誤。Youtubesupportfragment播放器不工作再上新的視頻初始化YouTube播放器

到目前爲止我已經使用了YouTube視頻播放器上方的視圖,並根據播放器狀態將其設置爲隱藏或可見狀態,並且它首次運行,但是當我重新加載新的YouTube視頻時,它在2秒後無法播放。

我已經張貼了我的佈局代碼自爆

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:background="@android:color/transparent"> 

    <FrameLayout 
     android:id="@+id/youtube_layout" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:background="@color/blue" 
     /> 

    <ImageView 
     android:layout_width="@dimen/dimen_size_40dp" 
     android:layout_height="@dimen/dimen_size_40dp" 
     android:layout_alignParentEnd="true" 
     android:scaleType="centerInside" 
     android:layout_gravity="end" 
     android:src="@drawable/ic_mode_edit_white_48" /> 

</RelativeLayout> 

任何人都請讓我知道我做了什麼錯呢?

+0

你可以參考這個[相關SO線程(http://stackoverflow.com/a/29676512/5832311)。嘗試在佈局中移除YouTubePlayerView中的填充。您也可以檢查這是否是特定於設備[isue](http://stackoverflow.com/questions/27834351/the-youtubeplayerview-is-obscured-by-com-lbe-security-service-core-client-af/29765413 #29765413)這可能是由於透明視圖與YouTubeAndroidPlayer視圖重疊。 – abielita

+0

@abielita我編輯過並添加了佈局代碼,請檢查它。我沒有添加任何邊距佈局,但根容器的填充爲16dp –

回答

0

請勿在youtubeview或碎片上覆蓋任何視圖。只需給imageview一些頂部邊距,或者您可以在imageview標籤內使用layout_below屬性。

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="match_parent" 
android:layout_height="wrap_content" 
android:background="@android:color/transparent"> 

<FrameLayout 
    android:id="@+id/youtube_layout" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:background="@color/blue" 
    /> 

<ImageView 
    android:layout_width="@dimen/dimen_size_40dp" 
    android:layout_height="@dimen/dimen_size_40dp" 
    android:layout_alignParentEnd="true" 
    android:scaleType="centerInside" 
    android:layout_gravity="end" 

    android:layout_below="youtube_layout" // added this line 

    android:src="@drawable/ic_mode_edit_white_48" /> 

相關問題