Python Kivy How to Play Video

This is our ninth article in Python Kivy, in this article we are going to learn How to Play Video in Python Kivy,  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.

 

 

So before starting our coding you need to install these two libraries, if you don’t do this there will be error when you play the video in kivy.

 

 

 

Kivy Crash Course Articles

1: Kivy Crash Course Introduction & Installation

2: Introduction to Kv Design Language 

3: Kivy Button with Callbacks

4: Kivy Layout Management 

5: How to Create CheckBox in Kivy

6: Kivy Image And AsyncImage Example

7: How to Create Slider in Python Kivy

8: How to Create TextInput in Python Kivy

 

 

 

 

Also you can watch the complete video for this article

 

 

 

 

So now this is the complete source code for Python Kivy How to Play Video

 

 

OK in the above code, first of all i have imported the required modules from kivy, after that i have created my class the extends from the App class, and i have created the object of my video widget. and there are different attributes that you can use with kivy video widget.

 

 

  • duration: duration of the video. The duration defaults to -1, and is set to a real duration when the video is loaded. duration is a NumericProperty and defaults to -1.
  • eos: boolean, indicates whether the video has finished playing or not (reached the end of the stream). eos is a BooleanProperty and defaults to False.
  • loaded: boolean, indicates whether the video is loaded and ready for playback or not. loaded is a BooleanProperty and defaults to False.
  • options: options to pass at Video core object creation.

 

 

 

 

If you run the code this will be the result

Python Kivy How to Play Video
Python Kivy How to Play Video

 

 

Subscribe and Get Free Video Courses & Articles in your Email

 

1 thought on “Python Kivy How to Play Video”

Comments are closed.

Share via
Copy link
Powered by Social Snap
×