I'm making a MediaPlayer using python and pyglet. At the moment I can load any audio file just as intended. However I've run into an issue where pyglet only seems to load files at a speed of 2.4MBps. Now this is fine for 5min songs. However I'd like to be able to use it for audiobooks as well. These can be 10+ hours long and over 500MB in size.
There are two problems with those right now.
- It takes forever to load (windows already marks the window with "No response"). It will load eventually and play just fine, it just takes too long.
- The player itself starts eating up RAM. Loading a 700MB audiobook resulted in the application using almost 5GB of RAM.
Is there a way to fix these problems?
Not sure if my code would help, but these are the lines I assume are most relevant
import pyglet
self.media = pyglet.media.load(path, streaming=False)
self.player = pyglet.media.Player()
self.player.queue(self.media)
self.player.play()
Path to file (usually .m4a) is provided by other parts of the program