将YouTube视频嵌入Kivy [英] Embed youtube video in Kivy

查看:300
本文介绍了将YouTube视频嵌入Kivy的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用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.

我可以想到两种选择:

  1. 使用YouTube下载器应用来检索视频(或者,尝试对其中一个下载器进行黑客攻击,看看您是否能确定他们在做什么以及如何在Kivy中复制它).
  2. 使用Chromium嵌入式框架显示实际的网页.我不知道这是否适用于Flash,但从理论上讲,它将适用于任何HTML5视频(但并非所有视频都可以使用HTML5观看).有一个 CEFPython Garden窗口小部件,以及一个非花园的 CEFKivy组件,它具有最新的开发.
  1. 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).
  2. 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.

这篇关于将YouTube视频嵌入Kivy的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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