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:

  1. Import the usual kivy packages.
  2. Import the VideoPlayer package.
  3. Define the MyW() class.
  4. Define the __init__() method.
  5. Define videoplayer with your video.
  6. 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.