如何在 kivy 中播放来自网络的视频,例如 youtube

2023-03-20移动开发问题
62

本文介绍了如何在 kivy 中播放来自网络的视频,例如 youtube的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

我真的很想创建一个 kivy 应用程序,让我可以查看来自某些网络链接的视频.我该怎么做呢,比如有一个视频链接然后在 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.

推荐答案

视频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.在此处查看我对专门询问 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.

这篇关于如何在 kivy 中播放来自网络的视频,例如 youtube的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

The End

相关推荐

cocos2D iPhone中的UItextfield文本对齐问题
UItextfield text alignment issue in cocos2D iPhone(cocos2D iPhone中的UItextfield文本对齐问题)...
2024-08-12 移动开发问题
7

glReadPixel 停止使用 iOS6 Beta
glReadPixel stopped working with iOS6 Beta(glReadPixel 停止使用 iOS6 Beta)...
2024-08-12 移动开发问题
5

Cocos2d 人像模式在 iPhone 上不起作用
Cocos2d portrait mode not working on iPhone(Cocos2d 人像模式在 iPhone 上不起作用)...
2024-08-12 移动开发问题
2

电影播放时如何有菜单-iphone cocos2d
How to have a menu when a movie is playing-iphone cocos2d(电影播放时如何有菜单-iphone cocos2d)...
2024-08-12 移动开发问题
2

着色器程序在 Cocos2d 2.2 Obj.C iOS 12 中不起作用
Shader Program not working in Cocos2d 2.2 Obj.C iOS 12(着色器程序在 Cocos2d 2.2 Obj.C iOS 12 中不起作用)...
2024-08-12 移动开发问题
1

在 MPMoviePlayerController 中播放 mov 文件时出现问题
Problem playing mov file in MPMoviePlayerController(在 MPMoviePlayerController 中播放 mov 文件时出现问题)...
2024-08-12 移动开发问题
9