2011-03-29 16:23:12 +00:00
|
|
|
import kivy
|
|
|
|
kivy.require('1.0.4')
|
|
|
|
|
2011-03-29 17:41:25 +00:00
|
|
|
from sys import argv
|
2011-03-29 16:23:12 +00:00
|
|
|
from os.path import dirname, join
|
|
|
|
from kivy.app import App
|
|
|
|
from kivy.uix.video import Video
|
|
|
|
from kivy.uix.scatter import Scatter
|
|
|
|
|
|
|
|
|
|
|
|
class VideoPlayer(App):
|
|
|
|
|
|
|
|
def build(self):
|
2011-03-29 17:41:25 +00:00
|
|
|
if len(argv) > 1:
|
|
|
|
filename = argv[1]
|
|
|
|
else:
|
|
|
|
curdir = dirname(__file__)
|
2011-03-29 20:39:52 +00:00
|
|
|
filename = join(curdir, 'softboy.avi')
|
2011-03-29 16:23:12 +00:00
|
|
|
video = Video(source=filename, play=True)
|
|
|
|
scatter = Scatter()
|
|
|
|
video.bind(texture_size=scatter.setter('size'))
|
|
|
|
scatter.add_widget(video)
|
|
|
|
return scatter
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ in ('__main__', '__android__'):
|
|
|
|
VideoPlayer().run()
|