akivymd icon indicating copy to clipboard operation
akivymd copied to clipboard

Added MusicPlayer

Open Guhan-SenSam opened this issue 4 years ago • 12 comments

Description of Changes

This is a minimalistic Music Player Widget. The widget can play multiple audio files that are passed to it as a list. A user can skip to the next track,skip to the previous track,pause and play and seek to any point in the audio file. When an audio file finishes the next audio track is automatically played. User can display music name,singer name and an album art for each audio which is passed through their own respective lists.

NOTE:

  • For the widget to work you must use some other audio provider than sdl2. This is because sdl2 doesn't support audio seek functionality.

  • As of now size_hint and custom sizes do not work due to the unique sizing of each part of the widget. I will be working on adding this later.

Screenshots

Screenshot from 2021-05-04 09-19-56 ezgif com-gif-maker(1)

Guhan-SenSam avatar May 04 '21 04:05 Guhan-SenSam

soundloader somehow doesn't load corectly audio files on android ..

  • [ ] try add jnius autoclass to load mediaplayer instead in case android ..
  • [x] pygame or ffpyplayer for desktop ..

hmae avatar May 04 '21 09:05 hmae

Seems like a nice idea. Ill look into adding it

Guhan-SenSam avatar May 04 '21 10:05 Guhan-SenSam

@Guhan-SenSam Nice job :) However i get following error when clicking on next button:

component\akivymd\kivymd_extensions\akivymd\uix\musicplayer.py", line 192, in skip_next  
     self.current_pic = self.pictures[id + 1]
 IndexError: list index out of range

quitegreensky avatar May 05 '21 00:05 quitegreensky

Also is it possible to use like only 10-15 seconds for each sound track to keep the repo low in size? and limit them to only two tracks instead of three. I mean they don't look necessary.

quitegreensky avatar May 05 '21 00:05 quitegreensky

@quitegreensky Does this error appear only after pressing the next button after it has been pressed three times... Like it's only supposed to occur when the widget has reached the end of the list of the given audio files and the user presses the next button...but if the error is occurring on like the first click it may have something to do with the audio providers

Guhan-SenSam avatar May 05 '21 02:05 Guhan-SenSam

And ya I'll shorten the sound tracks and reduce them 👍

Guhan-SenSam avatar May 05 '21 02:05 Guhan-SenSam

I have reduced the file sizes and fixed the crash when user skips songs at end of song list. Now the widget just loops through all songs

Guhan-SenSam avatar May 05 '21 05:05 Guhan-SenSam

@Guhan-SenSam Sorry i was busy recently and forgot about this PR. I notice some strange behaviors when i was testing the changes. It seems the slider doesn't work. Can you fix it?

https://user-images.githubusercontent.com/55235027/118359576-5bd15000-b599-11eb-8495-1e4e6d62e623.mp4

quitegreensky avatar May 15 '21 11:05 quitegreensky

Hmm it works for me. I think it must be that on your machine kivy is taking sdl2 as the default audio player. sdl2 doesn't have any seek functionality and that's why the seek bar isn't working. We have to set the audio player at the start of the demo program. I previously only had set the environment variable inside the screen.py of the widget. I have set the environment variable to use ffmpeg in the main.py now. Should work now.

Guhan-SenSam avatar May 15 '21 16:05 Guhan-SenSam

I have added docs and fixed seek not working sometimes

Guhan-SenSam avatar May 31 '21 04:05 Guhan-SenSam

@Guhan-SenSam if you can make that image CD to be rotating while it is playing, that will be really awesome(just suggesting)

kengoon avatar Jun 08 '21 14:06 kengoon

Seems like a nice idea 💡

Guhan-SenSam avatar Jun 08 '21 14:06 Guhan-SenSam