相关疑难解决方法(0)

在布局层次结构中叠加在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万
查看次数

标签 统计

android ×1

youtube-api ×1

youtubeplayer ×1