Video¶
The Video widget is used to display video files and streams. Depending on your Video core provider, platform and plugins you will be able to play different formats. For example, pygame video provider only supports MPEG1 on Linux and OSX. GStreamer is more versatile, and can read many video containers and codecs such as MKV, OGV, AVI, MOV, FLV (if the correct gstreamer plugins are installed). Our VideoBase implementation is used under the hood.
The video loading is asynchronous - many properties are not available until the video is loaded (when the texture is created).
def on_position_change(instance, value):
print 'The 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)
- class kivy.uix.video.Video(**kwargs)¶
Bases: kivy.uix.image.Image
Video class. See module documentation for more information.
- duration¶
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.
- eos¶
Boolean, indicates if the video is done playing (reached end of stream).
eos is a BooleanProperty, default to False.
- options¶
Options to pass at Video core object creation.
New in version 1.0.4.
options is a kivy.properties.ObjectProperty, default to {}.
- play¶
Boolean, indicates if the video is playing. You can start/stop the video by setting this property.
# start playing the video 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¶
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.
- seek(percent)¶
Change the position to a percentage of duration. Percentage must be a value between 0-1.
Warning
Calling seek() before video is loaded have no impact.
New in version 1.2.0.
- texture_update(*largs)¶
This method is a no-op in Video widget.
- volume¶
Volume of the video, in the range 0-1. 1 mean full volume, 0 mean mute.
volume is a NumericProperty, default to 1.