Now, let's write the code for the Player class. This class will be responsible for the handling of audio playback and its related functions, such as pause, stop, seek, fast forward, rewind, change of volume, mute, and so on.
We will use the pyglet library to handle these functions.
Pyglet is a cross-platform library that uses the AVbin module to support a large variety of audio files.
You might want to look at the API documentation of the pyglet player, which is available at https://bitbucket.org/pyglet/pyglet/wiki/Home.
You can also access the documentation for the pyglet media player class by typing the following two lines in the Python interactive shell:
>>> import pyglet
>>> help(pyglet.media)
The online documentation at https://pyglet.readthedocs.org/ tells us that we can play an audio file by using the following code:
player...