In this video I’ll show you how to create a basic Video Player with Kivy!
Kivy comes with a basic videoplayer that you can use to do very basic video things.
There aren’t a lot of options to fiddle with, but if you just need to show a video in your app, this will work just fine.
#kivy #codemy
Python Code: vid.py
GitHub Code: vid.py
from kivy.lang import Builder
from kivymd.app import MDApp
from kivy.uix.videoplayer import VideoPlayer
class MainApp(MDApp):
title = "Simple Video"
def build(self):
self.theme_cls.theme_style = "Dark"
self.theme_cls.primary_palette = "BlueGray"
# Create videoPlayer Instance
player = VideoPlayer(source = "videos/intro.mp4")
# Assign VideoPlayer State
player.state = 'play'
# Set options
player.options = {'eos': 'loop'}
# Allow stretch
player.allow_stretch = True
# Return player
return player
MainApp().run()

Add comment