Embed youtube video in Kivy

不打扰是莪最后的温柔 提交于 2019-12-10 20:55:42

问题


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.


回答1:


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.

I can think of two options:

  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.


来源:https://stackoverflow.com/questions/24685982/embed-youtube-video-in-kivy

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!