【发布时间】:2017-10-06 08:10:08
【问题描述】:
我想在点击事件时停止这个 kivy 视频(默认播放)。我在树莓派上运行这个。这是我的 kv 和 python 代码。
<VideoScreen>:
name: 'Video'
BoxLayout:
Video:
id: 'video1'
source: './media/Sequence_#1.mp4'
state: root.current_video_state
volume: 1
options: {'eos': 'loop'}
allow_stretch: True
视频循环播放,点击它会切换到新屏幕“登录”,但视频不会停止并且仍在循环播放(我想在新屏幕加载后停止播放)。有许多其他屏幕屏幕使用屏幕管理器连接到视频屏幕。假设加载屏幕工作正常。忽略缩进。
class VideoScreen(Screen):
current_video_state = StringProperty()
def __init__(self, **kwargs):
super(VideoScreen, self).__init__(**kwargs)
self.bind(on_touch_down = self.on_stop)
self.current_video_state = self.get_set_current_video_state()
def get_set_current_video_state(self, *args):
while(args):
print('arg', args[0])
if args[0] == 'pause':
return 'pause'
return 'play'
def on_stop(self, *args):
self.state = 'pause'
self.get_set_current_video_state('pause')
self.parent.current = 'Login'
【问题讨论】:
-
视频小部件在树莓派上是否适合您?我无法让它工作,我认为很多其他人也有同样的问题。我们使用了像gist.github.com/natcl/005dc4c6434ed7b5a59a 这样的解决方法。你有没有做任何具体的事情来让它在树莓派上工作?
标签: python kivy kivy-language