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, the 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.
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', value)
video = Video(source='PandaSneezes.avi')
video.bind(position=on_position_change,
duration=on_duration_change)
-
class
kivy.uix.video.
Video
(**kwargs)[ソース]¶Added in 1.0.0 ベースクラス:
kivy.uix.image.Image
Video class. See module documentation for more information.
-
duration
¶Added in 1.0.0 Duration of the video. The duration defaults to -1, and is set to a real duration when the video is loaded.
duration
is aNumericProperty
and defaults to -1.
-
eos
¶Added in 1.0.0 Boolean, indicates whether the video has finished playing or not (reached the end of the stream).
eos
is aBooleanProperty
and defaults to False.
-
loaded
¶Added in バージョン 1.6.0 で追加 Boolean, indicates whether the video is loaded and ready for playback or not.
loaded
is aBooleanProperty
and defaults to False.
-
options
¶Added in バージョン 1.0.4 で追加 Options to pass at Video core object creation.
options
is ankivy.properties.ObjectProperty
and defaults to {}.
-
play
¶Added in 1.0.0 バージョン 1.4.0 で撤廃: Use
state
instead.Boolean, indicates whether the video is playing or not. 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 aBooleanProperty
and defaults to False.バージョン 1.4.0 で撤廃: Use
state
instead.
-
position
¶Added in 1.0.0 Position of the video between 0 and
duration
. The position defaults to -1 and is set to a real position when the video is loaded.position
is aNumericProperty
and defaults to -1.
-
seek
(percent)[ソース]¶Added in バージョン 1.2.0 で追加 Change the position to a percentage of duration. Percentage must be a value between 0-1.
警告
Calling seek() before the video is loaded has no impact.
-
state
¶Added in 1.0.0 String, indicates whether to play, pause, or stop the video:
# start playing the video at creation video = Video(source='movie.mkv', state='play') # create the video, and start later video = Video(source='movie.mkv') # and later video.state = 'play'
state
is anOptionProperty
and defaults to ‘stop’.
-
volume
¶Added in 1.0.0 Volume of the video, in the range 0-1. 1 means full volume, 0 means mute.
volume
is aNumericProperty
and defaults to 1.
-