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()



John Elder

John is the CEO of Codemy.com where he teaches over 100,000 students how to code! He founded one of the Internet's earliest advertising networks and sold it to a publicly company at the height of the first dot com boom. After that he developed the award-winning Submission-Spider search engine submission software that's been used by over 3 million individuals, businesses, and governments in over 42 countries. He's written several Amazon #1 best selling books on coding, and runs a popular Youtube coding channel.

View all posts

Add comment

Your email address will not be published. Required fields are marked *

John Elder