本文介绍了在 Kivy 中嵌入 youtube 视频的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想使用 youtube URL 在 Kivy 的小部件中嵌入视频.那可能吗 ?该文档提供了 VideoPlayer 的示例 - http://kivy.org/docs/api-kivy.uix.videoplayer.html 但它只用于播放本地文件.
I want to embed videos in a widget in Kivy using youtube URLs. Is that possible ?
The documentation gives example for VideoPlayer - http://kivy.org/docs/api-kivy.uix.videoplayer.html but its only for playing local files.
推荐答案
Kivy 可以从互联网上串流视频并在 VideoPlayer
中播放.但是,YouTube 不提供流式传输 URL.请记住,YouTube 只有在展示广告时才会获得报酬,这意味着他们希望您访问他们的网站并需要您使用他们的视频播放器.
Kivy can stream videos from the internet and play them in VideoPlayer
. However, YouTube does not provide a streaming URL. Remember that YouTube only gets paid when they show ads, which means they want you on their site and need you to use their video player.
我能想到两个选择:
- 使用 YouTube 下载器应用来检索视频(或者,尝试破解其中一个下载器,看看您是否能弄清楚他们在做什么以及如何在 Kivy 中复制它).
- 使用 Chromium Embedded Framework 显示实际网页.我不知道这是否适用于 Flash,但理论上它适用于任何 HTML5 视频(但并非所有视频都可以在 HTML5 中观看).有一个 CEFPython Garden 小部件 可用,以及一个非花园 CEFKivy 组件 有更新的发展.
- Use a YouTube downloader app to retrieve the video (or, alternatively, try to hack on one of the downloaders and see if you can figure out what they're doing and how to duplicate it in Kivy).
- Use the Chromium Embedded Framework to display an actual web page. I have no idea whether this will work with Flash or not, but in theory it would work for any HTML5 videos (but not all videos can be watched in HTML5). There is a CEFPython Garden widget available, as well as a non-Garden CEFKivy component which has more recent development.
这篇关于在 Kivy 中嵌入 youtube 视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!