Youtube API视频在不在全屏时停止(Youtube API Video stops when not on full screen)

编程入门 行业动态 更新时间:2024-10-26 15:25:07
Youtube API视频在不在全屏时停止(Youtube API Video stops when not on full screen)

我正在使用youtube API并执行了本教程中的说明:

http://javatechig.com/android/youtubeplayerview-example-in-android-using-youtube-api

一切都很好,但是当我没有全屏时,视频每秒都会停止。 这就像它播放1秒钟,停止,然后我必须再次按下播放按钮,然后它会在1秒后再次停止。 在全屏幕上,它播放完美。 我100%确定它不是互联网连接,因为我尝试了很多连接,它只能在全屏播放。 知道如何解决这个问题吗?

编辑:这不是手机,我在Nexus 5,索尼Xperia z1,HTC One,一些三星Galaxies上试过。 我多次重新检查代码,它完全相同,甚至是教程的复制粘贴。 当它不在全屏时它仍然停止。 我只使用了本教程,因为我想在将其嵌入到我的主项目之前确保它有效。

I'm using the youtube API and I did the instructions from this tutorial:

http://javatechig.com/android/youtubeplayerview-example-in-android-using-youtube-api

All is well, but when I'm not on full screen, the video keeps stopping every second. It's like it plays for 1 second, stops, then I have to press the play button again, then it will stop again after 1 second. On full screen, it plays perfectly. I'm 100% sure it's not the internet connection because I tried it with many connections and it ONLY plays properly on full screen. Any idea how I can fix this?

EDIT: It's not the phone either, I tried it on a Nexus 5, Sony Xperia z1, HTC One, a number of Samsung Galaxies. I rechecked the code multiple times, it's exactly the same, even did a copy paste of the tutorial. It still stops when it's not on full screen. I only used the tutorial, since I wanted to make sure it works before embedding it to my main project.

最满意答案

我通过移除youtube视频播放器中的填充来解决我的问题。 它现在无论方向如何都能完美呈现。

I solved my problem by removing the padding in the youtube video player. It now plays perfectly regardless of orientation.

更多推荐

本文发布于:2023-07-27 17:45:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1293547.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:全屏   视频   API   Youtube   screen

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!