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 MediaPlayer stops after playing 1 minute in background

I am playing an audio stream from mediaPlayer using a service but it stops playing the song after approx one minute of being in the background or the screen turned off. While on the other hand it works fine and completes the song when the appication…
1
vote
2 answers

Why Android MediaPlayer stuck in prepare() when the URL returns not found?

So this is the simple code I use to play an audio file in my app: MediaPlayer mediaPlayer = new MediaPlayer(); mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC); try { mediaPlayer.setDataSource(url); …
SSP
  • 431
  • 4
  • 16
1
vote
0 answers

Android saving audio/mp3 file to external storage

I have question about saving audio/mp3 file to external storage after saving the file it show in external storage but when I open any android music player the file not showing there I try to change the folder to "/storage/emulated/0/Music/" still…
BARMOD
  • 21
  • 3
1
vote
1 answer

Having trouble using react-native-video on react-native-tvos@^0.63.4-0

Bug We are using this library to build an application for AndroidTV which is heavily relied on Video streaming , so we decided to use this library and see how it goes. we only use HLS (m3u8) video formats for the application. we used ExoPlayer and…
1
vote
0 answers

Android MediaPlayer addTimedTextSource not notifying when caption 'ends', only when a caption 'starts'

I have a MediaPlayer setup and I'm loading in a .srt file from my Raw Resources, loading it in via addTimedTextSource and assigning a OnTimedTextListener. This all seems to be working, the OnTimedTextListener onTimedText events fire. However I only…
Iain Stanford
  • 606
  • 1
  • 6
  • 18
1
vote
1 answer

Update items in adapter when other item clicked

I am in stuck with pretty easy thing. I have an activity with Fragment which includes RecyclerView and custom adapter with items. This activity is about radio stations. So in my adapter I have several items with Play-Stop button. When I click on the…
1
vote
1 answer

How to show thumbnail of audio files from storage in android

I want to show the audio file thumbnail with rest of information, how can i parse the thumbnail of all the audio files Function for loading audio files in recycler view private void loadAudio() { ContentResolver contentResolver =…
Neeleshwar Kumar
  • 335
  • 3
  • 13
1
vote
1 answer

Not able to Record Video More than 2mins through Mediastore API for Android 11

I am trying a ScreenRecording application using media store API for Android 11. My issue is, I am able to record screen recording below 2mins only. If the screen recording exceeds more than 2 mins, the file got created but it is in Kbs size only on…
Nijanthan
  • 137
  • 2
  • 12
1
vote
0 answers

Getting error in MediaController(this) as i had used this in the adapter class

Getting error in MediaController(this) as i had used this in the adapter class to display video in recycler view. Can you please help me find the cause of the error I get? This is my implementation: class VersionAdapter(val…
1
vote
0 answers

How does setMaxStreams in SoundPool work?

In a video I was watching about SoundPool, it mentioned setMaxStreams. The streamer said that setMaxStreams allows SoundPool to dedicate a portion of memory to each stream and set them up before it's even used. This confused me since the name…
CodingChap
  • 1,088
  • 2
  • 10
  • 23
1
vote
0 answers

Player of audio android studio

I can not reproduce the sound when pressing the button, any possible solution? I use SDK 30. if(playingSongPosition !=position) imageView.setImageResource(R.drawable.icon_play); else …
1
vote
1 answer

MediaPlayer error: Attempt to invoke virtual method 'void android.media.MediaPlayer.start()' on a null object reference

I'm trying to make an app to play music files from the internal storage of the phone. This is the first method where all the songs are listed in a ListView. public void fileSearch() { String[] loadSongs = {MediaStore.Audio.Media._ID,…
T.RY
  • 23
  • 5
1
vote
0 answers

Service, setVolume and Seekbar

I have a service with MediaPlayer in it. I would like to change the volume in activity through seekbar. However, I can't invoke my function typed in service in activity. It returns for a null object. Is there anyone know how to fix it. Thanks for…
1
vote
1 answer

How many MediaPlayer instances should I create for playing a music collection?

Thinks I've considered so far: Just one for the currently playing song. For the next song a new instance is created every time. Though one also need to call prepare and I expect there to be a noticeable gap between the songs. One MediaPlayer…
user1785730
  • 3,150
  • 4
  • 27
  • 50
1
vote
1 answer

How to play android motion(Live) photo with MediaPlayer?

I want to play android motion photo with media player. But I don't want to use mediaPlayer.setDataSource(fileDescriptor, offset, length). Because I am not getting offset for Huawei device's Motion Photo. How can I get the offset for all device's…
ZeroOneZeroR
  • 667
  • 1
  • 7
  • 12
1 2 3
99
100