android-mediaplayer

How to pause and play media player when screen is locked or sleeps?

你。 提交于 2021-01-01 13:51:09
问题 I am using Java and xml to create an application for the summer. This app has music in the background, that I would like to pause and then play depending on the state it is in. When i lock my screen the music does not pause it keeps playing. How would i fix this, I have tried to use the method on this site: https://thinkandroid.wordpress.com/2010/01/24/handling-screen-off-and-screen-on-intents I have not been able to successfully get a working prototype, and I am working in android studio.

Service does not receive multimedia button click events

﹥>﹥吖頭↗ 提交于 2021-01-01 07:29:41
问题 I am making an application that should do some things when I press the multimedia buttons. I know that I have to create a service and catch all the events there. I did everything the documentation recommended, but I still do not receive click events in the application. I followed the following guidelines for writing a similar application: https://developer.android.com/guide/topics/media-apps/mediabuttons https://developer.android.com/reference/androidx/media/session/MediaButtonReceiver.html

Service does not receive multimedia button click events

那年仲夏 提交于 2021-01-01 07:29:00
问题 I am making an application that should do some things when I press the multimedia buttons. I know that I have to create a service and catch all the events there. I did everything the documentation recommended, but I still do not receive click events in the application. I followed the following guidelines for writing a similar application: https://developer.android.com/guide/topics/media-apps/mediabuttons https://developer.android.com/reference/androidx/media/session/MediaButtonReceiver.html

Android Video stops playing after multiple plays Error 1, 2147483648

白昼怎懂夜的黑 提交于 2020-12-01 10:26:06
问题 OK, this is a little frustrating, and I have searched Stack but none of the answers seems to help. I have an Android app which cycles through different content on the screen. At one point it plays a video, the same video, loaded from the same place. After a random number of plays, it decides to stop playing the video file and throws the error up above (-2147483648) which is a generic file not found / incorrect format error. The problem is the video plays correctly numerous times before this