【发布时间】:2016-07-31 07:47:31
【问题描述】:
我正在尝试使用 YouTube API 在浏览器中播放 YouTube 视频。我的片段由一个 FrameLayout 组成,我在其中播放视频。视频正在加载,但我一播放就停止。 错误日志如下:
W/YouTubeAndroidPlayerAPI: YouTube video playback stopped due to unauthorized overlay on top of player. The YouTubePlayerView is obscured by android.widget.LinearLayout{ffe4270 V........ ........ 5425,0-6505,1437 #7f0e00cd app:id/root}. 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: 830..
W/YouTubeAndroidPlayerAPI: YouTube video playback stopped due to unauthorized overlay on top of player. The YouTubePlayerView is not contained inside its ancestor android.support.v4.view.ViewPager{d17b08c VFED..... ......I. 0,210-1080,1794 #7f0e0089 app:id/viewPager}. The distances between the ancestor's edges and that of the YouTubePlayerView is: left: 1085, top: 0, right: -1085, bottom: 830 (these should all be positive).
我无法找出问题所在,因为没有视图会遮挡框架布局。 布局文件是:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/root"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<!-- Youtube fragment -->
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/youtube_fragment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="visible" />
<!--android:name="com.google.android.youtube.player.YouTubePlayerFragment"-->
</linearLayout>
如果我删除外部布局并只播放框架布局,它仍然会出错。
【问题讨论】:
-
你是怎么解决这个问题的。请分享您的解决方案。
标签: android video youtube youtube-api