Android implements simple music playback controls

Before I saw the web version of Netease music playback control, I happened to need a simple music playback function in an open source learning project. So I wonder if it is possible to encapsulate a music playback control, provide a default interface similar to Netease playback control, and provide the function of changing the interface. When in use, you only need to design the interface instead of managing the logic of music playback, so you realize a simple music playback control.

How to use the music playback control (minimusicview):

1. Use the default interface

(1) Add minimusicview to your layout

(2) Set music address and play music

(3) Stop music playback

The renderings are as follows:

2. Use custom layout

(1) Add minimusicview to your layout

(2) Set custom layout, set music address and play music

The renderings are as follows:

(3) Minimusicview also provides a callback listening interface for music status

You can perform the required actions in the corresponding monitoring, for example, when the headset is pulled out and the music play is stopped, the mMusicView.pausePlayMusic () can be suspended in the onHeadsetPullOut () interface to stop the music playing.

In addition, how to use minimusicview in the project and the source code can be obtained here. You can modify it as needed. If there are bugs in use, please leave a message. Thank you very much

The above is the whole content of this article. I hope it will be helpful to your study, and I hope you can support programming tips.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>