In this article we will see how we can pause media in player of PYGLET module in python. Pyglet is easy to use but powerful library for developing visually rich GUI applications like games, multimedia etc. A window is a “heavyweight” object occupying operating system resources. Windows may appear as floating regions or can be set to fill an entire screen (fullscreen). This module allows applications to specify a search path for resources. Pyglet can play WAV files, and if FFmpeg is installed, many other audio and video formats. Playback is handled by the Player class, which reads raw data from Source objects and provides methods for pausing, seeking, adjusting the volume, and so on. The Player class implements the best available audio device. Pausing media means that video time frame will get a temporary stop in action.
We can create a window and player object with the help of commands given below
# creating a window window = pyglet.window.Window(width, height, title) # creating a player for media player = pyglet.media.Player()
In order to do this we use
pauseplay method with the player object
Syntax : player.pause()
Argument : It takes no argument
Return : It returns None
Below is the implementation
Video is paused
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.
- PYGLET – Adding Media in Queue of Player
- PYGLET – Play Media in Player
- PYGLET – Media Player
- PYGLET – Manually Updating Texture of Media in Player
- PYGLET – Seek Media in Player
- PYGLET – Get Current Media Texture in Player
- PYGLET – Play Next Media in Player
- Python VLC MediaListPlayer - Setting Media Player to it
- Python VLC MediaListPlayer - Getting Media Player of it
- PYGLET – Step to Next Frame in Player
- PYGLET – Release the Resources of Player
- PYGLET – Current Source Ran-out event of Player
- PYGLET – Loading Media
- matplotlib.pyplot.pause() in Python
- pause method - Action Chains in Selenium Python
- Python VLC MediaListPlayer - Pause/Resume
- Create a Simple Two Player Game using Turtle in Python
- YouTube Media/Audio Download using Python | pafy
- Python VLC MediaList - Setting Single Media object to it
- Python - Media object in Tweepy
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.