相关疑难解决方法(0)

Android YouTubePlayer未经授权覆盖在播放器上方

我在片段中使用YouTubePlayer(Android api for android)我正在使用YouTube播放器为LinearLayout充气,这样:

fragmentManager = getActivity().getSupportFragmentManager();
                    fragmentTransaction = fragmentManager.beginTransaction();

                    player = new YouTubePlayerSupportFragment();
                    fragmentTransaction.add(R.id.youTubePlayerContainer, player); 
                    fragmentTransaction.commit();
Run Code Online (Sandbox Code Playgroud)

... youTubePlayerContainer是膨胀的LinearLayout

正确检测到播放器,开始播放并在第二站停止播放.日志显示以下内容:

YouTube video playback stopped due to unauthorized overlay on top of player. 
The YouTubePlayerView is obscured by android.widget.FrameLayout@4110d1f8. 
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..
Run Code Online (Sandbox Code Playgroud)

这是我的XML :(其中没有FrameLayout)

 <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" > …
Run Code Online (Sandbox Code Playgroud)

android youtube-api android-framelayout

17
推荐指数
3
解决办法
2万
查看次数

在布局层次结构中叠加在YouTubePlayerFragment或YouTubePlayerView上方的视图会导致播放立即暂停

我正在使用YouTube Android播放器API并希望在a顶部叠加视图YouTubePlayerFragment,以便在播放视频上方显示上下文信息和控件.

不幸的是,似乎播放不会在任何一个正常工作YouTubePlayerFragmentYouTubePlayerView每当有在布局层次结构中的播放器上方堆积一个或多个视图.在立即暂停之前,播放时间不到半秒.

通过使用SDK附带的Simple PlayerFragment演示的以下布局,可以重现该问题:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

  <fragment
      android:name="com.google.android.youtube.player.YouTubePlayerFragment"
      android:id="@+id/youtube_fragment"
      android:layout_width="match_parent"
      android:layout_height="match_parent"/>

  <TextView
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:textAppearance="@android:style/TextAppearance.Small"
      android:layout_alignParentTop="true"
      android:text="@string/playerfragment_text"/>

</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)

我已尝试使用两者的各种布局配置FrameLayout,RelativeLayout但问题始终是相同的.我意识到这个API已经发布为"实验性",但如果这是一个已知问题,它是许多实现的相当主要的阻止.有没有人有一个很好的解决方案或解决方法?

android youtube-api youtubeplayer

16
推荐指数
1
解决办法
1万
查看次数