Reader small image

You're reading from  Kivy - Interactive Applications and Games in Python

Product typeBook
Published inJun 2015
Reading LevelBeginner
Publisher
ISBN-139781785286926
Edition1st Edition
Languages
Tools
Right arrow
Author (1)
Roberto Ulloa
Roberto Ulloa
author image
Roberto Ulloa

Roberto Ulloa has a diverse academic record in multiple disciplines within the field of computer science. Currently, he is working with artificial societies as part of his PhD thesis at the University of Western Ontario. He obtained an MSc degree from the University of Costa Rica and taught programming and computer networking there. He has earned a living as a web developer, working with Python/Django and PHP/Wordpress. He collaborates with various researchers while also working on his own projects, including his blog (http://robertour.com). He constantly worries that the Internet has already become aware of itself and that we are not able to communicate with it because of the improbability of it being able to speak any of the 6,000-plus odd human languages that exist on the planet.
Read more about Roberto Ulloa

Right arrow

Video – play, pause, and stop


We will start with simple code in this section, and then gradually include functionality until we get a complete video player. In this section, we will discuss how to use the Video widget in order to stream a video from the Internet. Let's start with the code in the video.kv file:

1. # File name: video.kv
2. #:set _default_video "http://video.ted.com/talk/stream/2004/None/DanGilbert_2004-180k.mp4"
3. 
4. <Video>:
5.     allow_stretch: True
6.     color: 0,0,0,0
7.     source: _default_video

In this code, we initially create a constant value with the set directive (line 2). This directive allows us to have global values that we can use inside the Kivy language scope. For example, we set the source property of the Video class with the value of the _default_video constant (line 7).

We set up three properties for the Video class. The allow_stretch property (line 5) allows the video to stretch according to the screen size available. The color property (line 6...

lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Kivy - Interactive Applications and Games in Python
Published in: Jun 2015Publisher: ISBN-13: 9781785286926

Author (1)

author image
Roberto Ulloa

Roberto Ulloa has a diverse academic record in multiple disciplines within the field of computer science. Currently, he is working with artificial societies as part of his PhD thesis at the University of Western Ontario. He obtained an MSc degree from the University of Costa Rica and taught programming and computer networking there. He has earned a living as a web developer, working with Python/Django and PHP/Wordpress. He collaborates with various researchers while also working on his own projects, including his blog (http://robertour.com). He constantly worries that the Internet has already become aware of itself and that we are not able to communicate with it because of the improbability of it being able to speak any of the 6,000-plus odd human languages that exist on the planet.
Read more about Roberto Ulloa