如何在基维播放来自YouTube之类的网络视频 [英] How to play videos from the web like youtube in kivy
问题描述
我真的很想创建一个kivy应用程序,让我可以查看某些Web链接中的视频.我该如何去做,比如拥有视频链接然后在Kivy中播放?我已经阅读了文档,但没有理解.请帮忙.
I really want to create a kivy app that lets me view videos from certain web links. How can I go about doing this, Like having a link to a video then play it in Kivy? I already read the documentation and I don't get it. Please help.
推荐答案
Video
和 VideoPlayer
小部件都是能够播放来自网络的流视频.这是一个播放网络视频的简单示例:
The Video
and VideoPlayer
widgets are both capable of playing streaming videos from the web. Here's a simple example of playing a video from the web:
import kivy
kivy.require('1.8.0')
from kivy.app import App
from kivy.lang import Builder
root = Builder.load_string('''
VideoPlayer:
source: 'http://www.debone.com/VivVilConGminorRV578.mpg'
''')
class TestApp(App):
def build(self):
return root
if __name__ == '__main__':
TestApp().run()
这将适用于任何受支持的流媒体类型.但是请注意,YouTube不提供流URL.在我的问题中在此处查看我的答案.
This will work for any supported streaming media type. Note, however, that YouTube does not provide streaming URLs. Check my answer here to a question which was specifically asking about YouTube.
这篇关于如何在基维播放来自YouTube之类的网络视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!