VOOZH about

URL: https://www.geeksforgeeks.org/python/pyglet-seek-media-in-player/

⇱ PYGLET – Seek Media in Player - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

PYGLET – Seek Media in Player

Last Updated : 8 Dec, 2021

In this article, we will see how we can seek media of 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. Seek for playback to the indicated timestamp on the current source. Timestamp is expressed in seconds. If the timestamp is outside the duration of the source, it will be clamped to the end.

We can create a window and player object with the help of the 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 seek play method with the player object
Syntax : player.seek(time_stamp)
Argument : It takes integer as argument
Return : It returns None 
 

Below is the implementation  

Output : 

👁 Image


 

Comment
Article Tags: