Questions tagged [android-mediaplayer]

MediaPlayer class can be used to control playback of audio/video files and streams in Android devices

MediaPlayer class can be used to control playback of audio/video files and streams.

4792 questions
1
vote
2 answers

Sounds keep playing even after minimizing the app and restarts when navigating through fragments

After successfully implementing sounds on my weather app, it plays quite OK when a city is searched. But the problem is that even when I minimize the app, it still keeps playing the sounds on repeat until I close/exit the app. I would like it…
1
vote
2 answers

Play weather sounds based on it's icons

I've just finished implementing my app's weather icons, now I'm trying to play weather sounds on the app based on the icons the app is displaying. After doing long hours of thorough research, I found out to my shock that no one has ever asked…
1
vote
1 answer

Using Media Button Broadcasts with Samsung's default media player

I built an app using Intent.ACTION_MEDIA_BUTTON to control the current media play, but a customer reported it wasn't working with their Samsung music player. Does anyone know if the Samsung media player doesn't support media buttons, and if so how…
1
vote
3 answers

audio player service stops when phone sleeps

I am running audio player service but If I put my phone on sleep the player stops or the background service I don't know what's the problem. this is my music service class : public class MusicService extends Service { public static final String…
1
vote
1 answer

Stream video/audio from an endpoint protected by OAuth2, Android?

So I have to access a media file which is on the server. I have to add access token to header so I can access the file. My goal is to play the media. The usual code is like this: //for audio mediaPlayer = new…
SSP
  • 431
  • 4
  • 16
1
vote
1 answer

Mediaplayer is downloading the whole file instead of streaming it - HTTP streaming with flask backend

I am trying to make an android app that would stream audio from a webserver using http, streaming itself works with VLC and HTML "audio" tag but when trying to stream it using MediaPlayer the file just gets downloaded as a whole, not streamed. When…
1
vote
1 answer

How to pause MediaPlayer in Jetpack Compose

What is the correct way to pause MediaPlayer in Jetpack Compose? Suppose my UI has a list of sound items, and when clicking an item the sound is playing. I'm trying to figure out the best approach to pause the sound when the user goes background.
1
vote
2 answers

2 audios playing at the same time in mediapalyer in android

HELP PLEASE !! I'm using media player in recycler view and the problem is when different item's play buttons are clicked they all play at the same time. How can I stop the previous audio and start the new audio ? Here is the adapter code: public…
ghazalia
  • 63
  • 3
  • 9
1
vote
2 answers

media player in recyclerview play at the same

I'm using media player in recycler view and the problem is when different item's play buttons are clicked they all play at the same time. How can I stop the previous one and start the new one? public void onBindViewHolder(@NonNull…
ghazalia
  • 63
  • 3
  • 9
1
vote
1 answer

How can I make the media player play the music with the URL link?

I made for some time an app with a media player. But after a number of updates, I realized that the space required for downloading the app got very big. I decided to change the method and make the players play the music with the internet from a URL…
user15583048
1
vote
3 answers

How can i update UI from service using livedata?

I'm creating player app and i want to use foreground service for my media player. I need to update UI using livedata from service. I'm already read about using broadcast receiver but i want to use livedata.
1
vote
1 answer

Renaming and deleting a music playlist in Android 10+

I'm trying to update my old music player to support Android 10 and 11 (and 12 soon) My code to rename and delete a playlist broke due to changes in security I guess ?? Here is what used to work : private fun renamePlaylist(resolver: ContentResolver,…
FF75
  • 21
  • 3
1
vote
0 answers

How i can implement media player media session for lock screen?

I'm building a music app and i need to display control panel of my media player on lock screen. How i can do that? I'm already read about media session but idk how to correctly implement it. I need some example
1
vote
0 answers

MediaPlayer delayed a few seconds before onComplete got called on some devices

I tried to play a local mp4 video file on my TV Box. I found a weird issue with MediaPlayer's playback speed. Here're my logs: 19:30:09.346 E/MediaPlayerManager: currentMediaPlayer's duration = 16021 19:30:09.715 E/MediaPlayerManager:…
Kingfisher Phuoc
  • 8,052
  • 9
  • 46
  • 86
1
vote
1 answer

MediaHTTPConnection: Attempt to invoke virtual method 'java.net.URLConnection java.net.URL.openConnection()' on a null object reference

i created a MediaPlayer on adapter void setData(Users data) { mediaPlayer = new MediaPlayer(); if (!data.getAudioIntro().equals("")) { try { …