You can play video files using Video widget. Depending of your Video core provider, you may be able to play differents formats. For example, pygame video provider allow only MPEG1 on Linux and OSX. GStreamer is more versatile, and can play many other video format, as MKV, OGV, AVI, MOV, FLV... depending of the gstreamer plugins installed.
The video loading is also asynchronous. Many properties are not available until the video is loaded. The video is loaded when the texture is created.
def on_position_change(instance, value):
print 'The initial position in the video is', value
def on_duration_change(instance, value):
print 'The duration of the video is', video
video = Video(source='PandaSneezes.avi')
video.bind(position=on_position_change,
duration=on_duration_change)
Bases: kivy.uix.image.Image
Video class. See module documentation for more informations.
Duration of the video. The duration is default to -1, and set to real duration when the video is loaded.
duration is a NumericProperty, default to -1.
Boolean indicate if the video is playing. You can start/stop the video by setting this property.
# start the video playing at creation
video = Video(source='movie.mkv', play=True)
# create the video, and start later
video = Video(source='movie.mkv')
# and later
video.play = True
play is a BooleanProperty, default to False.
Position of the video between 0 and duration. The position is default to -1, and set to real position when the video is loaded.
position is a NumericProperty, default to -1.
Volume of the video, in the range 0-1. 1 mean full volume, 0 mean mute.
volume is a NumericProperty, default to 1.