Finally got around to begin adapting as a media player, few questions: #9
Replies: 1 comment
-
No
Use the FFmpeg's
This is audio player right? (Spotify is, so must be) Then, the best way IMHO to go about this is to separate media reading and playing. Have the backend to read music files and cache them in memory in raw samples. Stored them in The backend can expose the With this design, |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Repo: https://github.com/nednoodlehead/ffmpegio_adaption
(Code originates from the audio-example library)
First question: Do we have any easy, built-in way to measure how long a song is / how long it has been playing?
I was looking at using
stream.get_time(), but it seems to not work as I expected, it seems to be a linear timer that has nothing to do with the actual active stream. If this is not possible, I'm guessing the best way we have to measure the time is to have a timer starting when audio is played, and paused when the audio is paused, which brings me to my second question:Is it possible to begin Audio at a certain time? Looking at the __init__.py of ffmpegio, where the streams (i think thats the right word) come from, there seems to be no room made for any sort of 'time' or any type of argument (even after reading those docs in the file for the
openfunction)Finally, and I know this isn't exactly about
ffmpegio, but what is the most reasonable way to play music in terms of functionality similar to spotify (or in my casepunge), where you play and pause songs at will and it acts.. as expected.The (simplified way) I had
Pungework was by having the logic and controlling of the songs handled by a single class instance, and that instance would spawn a special type of thread, one that can be killed. It would re-create the thread each time 'Play' was clicked.Is this inefficient? or is this as good as playing music will get? Could
ffmpegiobe ran on a single thread without the need for consistently killing and creating a new threads? ( The stream.stop_stream() method seems promising for this ! )Beta Was this translation helpful? Give feedback.
All reactions