AsyncImage – creating a cover for the video

In this section, we will learn how to put up a cover that will be displayed when the video is not playing. This image will serve as a decoration when the video hasn't started, and in the case of the TED video, it is usually an image that involves the speaker. Let's start introducing a few changes in the code of video.kv:

58. # File name: video.kv 
59. ...
60. #:set _default_image "http://images.ted.com/images/ted/016a827cc0757092a0439ab2a63feca8655b6c29_1600x1200.jpg"
61. 
62. <Video>:
63.     cover: _cover
64.     image: _default_image
65.     ...
66.     AsyncImage:
67.         id: _cover
68.         source: root.image
69.         size: root.width,root.height

In this code, we created another constant (_default_image) with the set directive (line ...

Get Kivy – Interactive Applications and Games in Python - Second Edition 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.