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

Android Listview and media player

I currently have a listview and when you click on an item it takes you to a new window and starts playing the song associated to that position. The problem is when I press the back button to return to the listview and I press the same item, the…
Splitusa
  • 1,181
  • 7
  • 31
  • 51
1
vote
2 answers

Stop notification sound from MediaPlayer

My application notifications should appear even when the phone is silent. This is a prayer app and, for example, the notification needs to sound when it comes to prayer even if the phone is in silent mode at night, which can sometimes be long (eg:…
Seyf
  • 73
  • 7
1
vote
0 answers

Song is not playing using MediaPlayer. Error: JNI: env->IsInstanceOf fails and JNIMediaPlayerFactory: bIsQCMediaPlayerPresent 0

The below code is a section of a music player project in which songs are fetched from External Storage and displayed using RecyclerView. Using the Toast I displayed the path and its displaying correct path. But still on clicking a particular song…
Mohit Kumar
  • 41
  • 1
  • 7
1
vote
0 answers

Android : Can't change the playback speed. MediaPlayer

I want to change the playback speed. But it doesn't work properly on Android 7.0 (Xperia XZ). When the playback speed is 1.0f, it will be played. class MainActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { …
akihirot89
  • 11
  • 2
1
vote
0 answers

How to retrieve list of all local audio files and its parameters properly?

For now, I'm doing this with content resolver. Code: private fun loadMedia(): List { val list = mutableListOf() val contentResolver = context.contentResolver val uri =…
Viktor
  • 566
  • 5
  • 17
1
vote
1 answer

Android mediaPlayer.getDuration() return 0 or -1

I am creating online media player where we are playing song with the help of URL. In Media Player we are displaying Total time of song, for displaying time we are using mediaPlayer.getDuration() function but it always returning -1. When I am…
1
vote
0 answers

Android MediaPlayer: getting Error (1,-1004) on API 19?

I am using MediaPlayer to play music from url when my activity start. It works well on API above 19 but not working on API 19 (emulator). Why is this happening and how to solve it? I have searched this problem on stackoverflow, most of the answer…
cindy
  • 21
  • 6
1
vote
0 answers

try to use mediaplayer freely anywhere

so, I am developing a online music player app with json data. here i am using recycelr view to show list of song. I have to face problem in controlling the media player to pause start in another activity. so I create a new file Audio.kt in this file…
Synonian_raj
  • 154
  • 1
  • 13
1
vote
1 answer

Why MediaPlayer does not block UI thread?

I am doing some tests about Service and I find that when I do a heavy task in Service, it will block the UI thread, but when I start MediaPlayer in Service it does not block the UI thread. I do not know why it is not blocking the UI thread. Is it…
Albert Khang
  • 621
  • 6
  • 17
1
vote
1 answer

Android mediaplayer - unable setDataSource - URL

I'm trying to set a song on MediaPlayer with URL, but for some reason, I keep getting an error like this: Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.media.MediaPlayer.setDataSource(java.lang.String)' on…
E.Bolandian
  • 553
  • 10
  • 35
1
vote
1 answer

Set up ProgressBar with MediaPlayer inside RecyclerView android

I have RecyclerView inside a Fragment. The RecyclerView's every item has a ProgressBar. In the itemView's onClick listener a MediaPlayer plays a sound. I want to indicate the MediaPlayer's progress with a ProgressBar, which is inside the same…
1
vote
0 answers

What are the options to export a audio file with speed and pitch changed?

I'm trying to make an Android app that simply play and exports audio files with the speed and pitch chosen by the user. Since API level 23 MediaPlayer gives you PlaybackParams and this is enough for playing. But what are the options for saving this…
marmay
  • 39
  • 3
1
vote
0 answers

Android: Media Player live streaming stop after few min in more then 15 min size audio and not buffer that audio in online stream

In my Media Player app I use default media player and in my app song stops in between 10-13 min and that's starts from 0 again when click on pause icon. I have an issue with Media player always stopping randomly after some few mins. then I put…
1
vote
0 answers

MediaPlayer's seekTo method not working with mkv files

I am having a very weird problem with hooking up a Seekbar to a MediaPlayer with mkv files with vorbis encoding. This is a supported format according to https://developer.android.com/guide/topics/media/media-formats When the MediaPlayer is updated…
John Glen
  • 771
  • 7
  • 24
1
vote
0 answers

Android MediaRecorder getMaxAmplitude always returns 0 on Pixel XL

Below given code is working fine in other devices like Samsung and Honor but not working in Google Pixel XL. In pixel device recorder.getMaxAmplitude() always return 0. MediaRecorder recorder = new MediaRecorder(); …
1 2 3
99
100