上述YouTubePlayerFragment或YouTubePlayerView在布局层次原因叠加播放次数立即暂停 [英] Views overlayed above YouTubePlayerFragment or YouTubePlayerView in the layout hierarchy cause playback to pause immediately

查看:1335
本文介绍了上述YouTubePlayerFragment或YouTubePlayerView在布局层次原因叠加播放次数立即暂停的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用YouTube的Andr​​oid播放器API,并希望覆盖一个视图顶部的 YouTubePlayerFragment 以显示上下文信息和控制上面正在播放的视频。

I'm using the YouTube Android Player API and want to overlay a view on top of a YouTubePlayerFragment in order to display contextual information and controls above the playing video.

不幸的是,似乎播放不能在正常工作是 YouTubePlayerFragment YouTubePlayerView 每当有一个或多个堆叠玩家在版图层次上述看法。播放时不到半秒前立即暂停。

Unfortunately it seems playback does not work correctly in either a YouTubePlayerFragment or YouTubePlayerView whenever a there is one or more views stacked above the player in the layout hierarchy. Playback occurs for less than half a second before immediately pausing.

这个问题可以通过下面的布局简单PlayerFragment演示转载附带的SDK:

The issue can be reproduced by using the following layout for the Simple PlayerFragment demo that ships with the SDK:

<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>

我尝试了各种布局配置同时使用的FrameLayout RelativeLayout的但问题是始终不变的。我知道这个API已经发布的实验性的,但如果这是一个已知的问题,它是有很多实现的pretty的主要拦截。没有人有一个很好的解决方案或解决方法吗?

I have tried various layout configurations using both FrameLayout and RelativeLayout but the issue is always the same. I realise this API has been released as "experimental", but if this is a known issue it is a pretty major blocker for a lot of implementations. Does anyone have a good solution or workaround?

推荐答案

杰夫 - 这可以作为设计的。不支持对任何我们的YouTube播放器(包括在YouTube的Andr​​oid播放器)顶部覆盖层。当检测覆盖,播放停止,日志中包含的信息在调试问题有帮助。 我们支持行动吧重叠,看看这个演示,以了解更多:<一href="https://developers.google.com/youtube/android/player/sample-applications#Overlay_ActionBar_Demo">https://developers.google.com/youtube/android/player/sample-applications#Overlay_ActionBar_Demo.

Jeff - this works as designed. Overlays on top of any of our YouTube players (including the YouTube Android Player) are not supported. When an overlay is detected, playback stops and the log contains information helpful in debugging the issue. We do support Action Bar overlays, take a look at this demo to learn more: https://developers.google.com/youtube/android/player/sample-applications#Overlay_ActionBar_Demo.

这篇关于上述YouTubePlayerFragment或YouTubePlayerView在布局层次原因叠加播放次数立即暂停的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆