Working with video
The video reproduction is a useful tool for any app. In this app, we will load a widget to reproduce a video file in our app.
Getting ready
It is necessary to have a video file in the usual format to be reproduced in our app (.avi
, .mov
, .mpg
, .mp4
, .flv
, .wmv
, .ogg
). If you do not have one, you can visit https://commons.wikimedia.org/wiki/Main_Page to get free media.
How to do it…
In this recipe, we are going to use a simple Python file to create our app within a player widget. To complete the task, follow these:
- Import the usual
kivy
packages. - Import the
VideoPlayer
package. - Define the
MyW()
class. - Define the
__init__()
method. - Define
videoplayer
with your video. - Add the video player to the app.
import kivy kivy.require('1.9.0') from ...
Get Kivy Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.