我刚开始使用 Kivy,如果我做错了什么,请指出.我正在尝试使用视频播放器.也就是说,我似乎无法让它识别任何选项",我真的很想要一种隐藏控件的方法(以防止用户在电影播放时停止/暂停/更改音量/交互等)运行).
I'm just starting out with Kivy, so please point out if I'm doing something wrong.. I'm trying to work with the video player. Namely, I can't seem to get it to recognize any "options", and I'd really like a way to hide the controls (to prevent the user from stopping/pausing/changing volume/interacting etc.. while the movie is running).
这是我目前所得到的:
import kivy
kivy.require('1.9.0')
from kivy.app import App
from kivy.uix.videoplayer import VideoPlayer
class MyApp(App):
def build(self):
self.player = VideoPlayer(fullscreen=True, allow_fullscreen=True, source='mymovie.mp4', state='play', options={'allow_stretch': True, 'eos': 'loop', 'fullscreen': True})
return(self.player)
if __name__ == '__main__':
MyApp().run()
eos: 上面的循环",似乎完全被忽略了.就像全屏"一样.双击播放器不会使其全屏运行.
eos: 'loop' above, seems to be completely ignored. As does 'fullscreen'. Double clicking the player doesn't cause it to run in full screen.
我正在 Windows 上进行测试(但希望移植到 android),在后台的控制台"窗口中,我有 2 个警告应该对我有所帮助,但我想我知道的不够多,不知道如何照顾它:
I'm testing on Windows (but hoping to port to android), and in the "console" window in the background I have 2 warnings that should help me, but I guess I don't know enough to know how to take care of it:
[WARNING ] [VideoPlayer ] Cannot switch to fullscreen, window not found.
[WARNING ] [VideoPlayer ] Cannot switch to fullscreen, window not found.
理想情况下,我会让它全屏运行,并且能够禁用控件(因此用户可以使用键盘/触摸/计时器事件等与事物进行交互),但我找不到任何有关如何操作的文档禁用它们.有什么指点吗?
Ideally, I would get it running in fullscreen and would be able to disable the controls (so the user can interact with things using keyboard/touch/timer events/etc.) but I can't find any documentation on how to disable them. Any pointers?
我已经设法让窗口本身以全屏模式运行,但我认为这不是一回事.谢谢!
I've managed to get the window itself to run in fullscreen, but that's not the same thing, I don't think. Thanks!
我通过使用 kivy.uix.video.Video
而不是 kivy.uix.videoplayer.VideoPlayer代码>.我不知道这是否是我最初应该做的事情(刚刚开始!),但以防万一其他人遇到这个问题,这对我有用:
I solved my issues by using kivy.uix.video.Video
instead of kivy.uix.videoplayer.VideoPlayer
. I don't know if that's what I was expected to do in the first place (just starting out!), but just in case someone else has this problem, here's what worked for me:
import kivy
kivy.require('1.9.0')
from kivy.app import App
from kivy.uix.video import Video
class MyApp(App):
def build(self):
video = Video(source='mymovie.mp4')
video.state='play'
video.options = {'eos': 'loop'}
video.allow_stretch=True
return video
if __name__ == '__main__':
MyApp().run()
这篇关于Kivy VideoPlayer 全屏、循环和隐藏控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!