MyMusicPlayer | a musicplayer developed by yueban
kandi X-RAY | MyMusicPlayer Summary
kandi X-RAY | MyMusicPlayer Summary
a musicplayer developed by yueban
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Play music .
- Inits the group list .
- Insert a playlist .
- Sets the title layout of the title .
- Init playlist .
- Get all music list .
- Convert hanyin string to uanyis .
- Initialize the music list .
- helper method to create the current music view
- Init the clear drawable .
MyMusicPlayer Key Features
MyMusicPlayer Examples and Code Snippets
Community Discussions
Trending Discussions on MyMusicPlayer
QUESTION
I'm on creating a simple music player with Exoplayer in Android Kotlin. (Playing local MP3 in storage)
The problem is that the playback music is stopped outside the app and if the mobile turns on sleep mode. So, I tried to implement the Foreground service, but it didn't work.
Below is my code without the part I tried to implement the Foreground service.
Please, let me know how to resolve this issue or how to correctly implement foreground service.
class AudioviewActivity : AppCompatActivity() {
...ANSWER
Answered 2020-Aug-02 at 08:27Since you are releasing player in Onstop , So when your app goes in background then Onstop is being called and you are releasing player , So dont release player in OnStop(), remove that part of the code.
QUESTION
I followed a youtube tutorial that showed how to create an android mp3 player app. The App has multiple buttons, one for previous song, one for Pause/Play and one for next song. Play/Pause buttons, only pause my MediaPlayer and they work perfectly no matter how many times i click them.
On the other hand, Next/Previous buttons causes my code to throw NullPointerException. I found out it was because MediaPlayer.create(Context, Uri)
function sometimes returns null. On my app, function fails approx. on every tenth press of Next button, or on every tenth creation of MediaPlayer.
Is there a way to fix this? I tried modifying application on my own, but it didn't work. I tried looping variable myMysicPlayer
in continue while loop, until it gets while != null
ANSWER
Answered 2019-Aug-07 at 17:20
My mistake was:
1) i used myMediaPlayer.release()
method, that releases all resources
associated with the MediaPlayer
object
2) instead of using the same MediaPlayer
object, i always create new one with myMediaPlayer = MediaPlayer.create(Context, Uri),
and
MediaPlayer.create(Context, Uri)
returns null on failure, which than causes NullPointerException
.
Solution was simple. I deleted myMediaPlayer.release()
line and instead of creating new object, i modified the one whose reference i got in the begining.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install MyMusicPlayer
You can use MyMusicPlayer like any standard Java library. Please include the the jar files in your classpath. You can also use any IDE and you can run and debug the MyMusicPlayer component as you would do with any other Java program. Best practice is to use a build tool that supports dependency management such as Maven or Gradle. For Maven installation, please refer maven.apache.org. For Gradle installation, please refer gradle.org .
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page