問題描述
我真的很想創(chuàng)建一個 kivy 應(yīng)用程序,讓我可以查看來自某些網(wǎng)絡(luò)鏈接的視頻.我該怎么做呢,比如有一個視頻鏈接然后在 Kivy 中播放?我已經(jīng)閱讀了文檔,但我不明白.請幫忙.
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.
推薦答案
視頻
和VideoPlayer
小部件都能夠播放來自網(wǎng)絡(luò)的流式視頻.下面是一個播放網(wǎng)絡(luò)視頻的簡單示例:
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.在此處查看我對專門詢問 YouTube 的問題的回答.
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.
這篇關(guān)于如何在 kivy 中播放來自網(wǎng)絡(luò)的視頻,例如 youtube的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!