Questions tagged [android-mediaplayer]

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

1
vote
1answer
15 views

MediaPlayer.setDataSource deprecated on android 6

I am creating an app using MediaPlayer to play audio file from raw folder. It works fine on android 7 and above but for android 6 it crashes. It seems MediaPlayer.setDataSource is deprecated on ...
0
votes
0answers
17 views

How to play audio stream (NOT FILE) in Android application from URL

I am trying to play audio from this stream (take note that this is NOT A FILE) https://listen.radioaktywne.pl:8443/ramp3 , unfortunately with no luck whatsoever. When copy-pasting this link to my web ...
0
votes
1answer
15 views

App that plays audio file from internal Storage, Android Studio (JAVA)

I have attempted to create an App that plays wavfiles that have been created from another app I have made that records wavFiles. The wav files I would like to play are stored in the following ...
0
votes
1answer
11 views

How to run a background video in Android activity?

I want to implement a background video in the main activity of my App. Initially, I tried adding this video as a normal video using VideoView, but there was no setting to make it cover the entire ...
-1
votes
0answers
20 views

Avoid Media Player playing audio files simultaneously RecyclerView

my problem is when there are multiple audio files inside the recycler, for example when the user has multiple voice recordings. if one of the recordings gets played also the other recordings get ...
0
votes
1answer
26 views

Can't seek audio files prepared with HTTP source (Android MediaPlayer)

So I'm trying to build some sort of a media player, the application prepares audio from an external source (HTTP server sitting on another device), when trying to seek the MediaPlayer returns "Stream ...
0
votes
0answers
10 views

MediaPlayer onBufferingUpdate() not reaching 100% in seek bar

override fun onBufferingUpdate(mp: MediaPlayer?, percent: Int) { seekBar.setSecondaryProgress(percent) Log.e("@@@", percent.toString()) } I try above code to achieve buffer ...
2
votes
0answers
80 views
+100

Android - Play SoundFont with MIDI file

I have one midi file and I have played that midi file using MediaPlayer in android using the following code: val mMediaPlayer = MediaPlayer.create(context, R.raw.test_ring_1) mMediaPlayer?.start() ...
0
votes
1answer
38 views

How to stop a runnable in a mediaplayer? [duplicate]

I have a mp3 player that has a "Runnable" that is working even when the user already has exit the activity, is there a way to stop the runnable when the user press back: I have tryied adding flags ...
0
votes
0answers
13 views

How to change the reference file of a media player?

The short version of a sound is played on a button click. I have a switch enabling the long version of the sound to be played when true. I have the longer mp3 sound in android studio. How do I set the ...
0
votes
0answers
23 views

How can I play the song which is in the raw folder with the use of path gotten from database as a string?

I have stored a .mp3 file on raw folder in my Android studio and I have received the path of that file as a string, now How can I play the song with the use of that string using media player? I have ...
0
votes
0answers
28 views

Exoplayer/Android Media Player Not Playing Video with AC3 Audio

I'm using Exoplayer version 2 for playing Video from Internal Storage and it works fine but whenever video contains ac3 type audio,exoplayer not plays audio,it only display video. please help me ...
0
votes
1answer
18 views

How do you make a mediaplayer play a sound louder?

In my application a sound is triggered by a button click, but the sound is relatively quiet and requires me to manually increase the volume on my phone to hear. Is there a way to increase the volume ...
0
votes
0answers
8 views

fatal error when play m3u8 stream using mediaplayer with session info in header

When I played m3u8 stream with header info by Mediaplayer I got this error: function that i used: mediaplayer.setDataSource(context, Uri.parse(path), headers); 2019-06-09 16:55:01.101 31239-31559/? ...
0
votes
2answers
24 views

Starting MediaPlayer from Timer

I am developing a Battery Alarm App. and I want to play music using media-player in every one minute using the Timer and also want to repeat music 2 times within one minute. This works fine for the ...
0
votes
0answers
16 views

Is it possible to download and play audio stream on Android?

I am creating a podcast app, but I want to save the podcast while is playing. For example, there is podcast streaming on the internet with that streaming URL can I use any HTTP library (OkHTTP) on ...
0
votes
1answer
26 views

How to play streaming music file from cloud storage service?

I want to play a music file which will be retrieved from a cloud storage service (such as Google drive or Mega.nz). I shared the file so anyone who have the link can access to it. I'm using ...
0
votes
0answers
14 views

Start/stop controls in a Notification area for a custom audio player

I'm posting my solution for custom media player controls using the Notification class. I hope it helps other people and saves them time. The new androidx has a special style for media player objects ...
-4
votes
2answers
185 views

Android: MediaPlayer Play, Pause, Resume audio file like WhatsApp

I'm working on one project, I tried to play audio files like WhatsApp. suppose three files in a row sent by the user, ** I want to play/pause/resume audio file exactly like WhatsApp** - what I want ...
0
votes
2answers
23 views

How to play sound on button click, even if MediaPlayer is already playing a sound?

On button click, I wrote some code to play a simple sound. I would like this sound to play even over previously created sound with the same button (example, if the user clicks the button repeatedly ...
0
votes
0answers
18 views

MediaPlayer service not (re-)starting

I use a MediaPlayer in a service that should only be playing when certain fragments are opened. It should stop/pause playing when the home button is pressed. Within those fragments I have a button ...
-1
votes
0answers
7 views

What api can help me to make a crossfade of 2 audios in android? [duplicate]

I made first realisation using mediaplayer, but it doesn't work normally, because of using 2 objects of mediaplayer. Soundpool cannot be used because of restriction to size (i need to use files more ...
1
vote
0answers
22 views

My custom wave file can't be prepared by mediaplayer. Prepare failed.: status =0x1

I have a problem with a media player. It won't prepare after setting data source. I have custom wav file with metadata at the end of it. Other wav files are played noramly by media player like my ...
0
votes
2answers
20 views

How to Use Intent for Media Player?

I want to use intent for my homework application. When i click button1, my SoundActivity opening, after playing sound1.mp3 file. But i wanna when i clicked button2, sound2.mp3 file playing in ...
0
votes
1answer
24 views

High ram usage and same process showing multiple times?

I made a mediaplayer in Android Studio which uses a Service to control playback. Now everything works fine and i don't notice any lag even though my logcat says 123 frames where skipped during ...
0
votes
0answers
19 views

How to properly use MediaPlayer as notification?

Actually i'm developing an app for an Android Device with a barcode scanner and i'm trying to set a .wav sound that should be played every time i've read the same barcode. on my scan method i'm ...
0
votes
1answer
31 views

Problems playing two raw files at the same time through two MediaPlayers

I'm developing a Voip-Application and i have an edge case where i want to play two raw files at the same time. When i have an incoming call from my application i am creating a new Mediaplayer and ...
0
votes
0answers
6 views

Media Player BufferUpdate not working with MediaPlayer.setOnBufferUpdate

I have created a mediaplayer related application in which i have problem about BufferUpdate below is my code. My seek_bar.xml file <?xml version="1.0" encoding="utf-8"?> <item android:id="...
0
votes
0answers
15 views

Make MediaPlayer load from URL only

I would like the MediaPlayer to load the video from URL and not to search the local files - is it possible? I receive the error message for the video from the external server: MediaPlayer: ...
-1
votes
0answers
16 views

How to encode streamable MP4 with mediacodec and mediamuxer on android?

1.I just decode a .mp4 file with MediaExtractor and MediaCodec 2.encode the video frame from step 1 by MediaCodec and write to MP4 file by MediaMuxer 3.encode some pcm data to aac and and write to MP4 ...
-2
votes
1answer
28 views

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

I am calling stop() method on my mediaplayer instance and it is showing "Attempt to invoke virtual method 'void android.media.MediaPlayer.stop()' on a null object reference" which means mediaplayer ...
-1
votes
2answers
50 views

Android: Long press of button to save sound (Soundboard)

I have put together a basic soundboard using Android Studio. Please be warned; I am new to Android app development. I have a series of buttons that I have managed to get to play some .mp3 sounds ...
0
votes
0answers
27 views

Alternative to MediaPlayer

Actually i'm trying to play a sound inside my raw folder in the project, The issue is that the device for which i'm developing the app doesn't support MediaPlayer and by following this guide in ...
0
votes
0answers
18 views

Android Kotlin : MediaPlayer setOnCompletionListener is not triggered

When I execute and play an audio by my mediaplayer to the end, setOnCompletionListener is not triggered . Would you please tell me what other things do I have to set ? mediaPlayer = MediaPlayer(...
0
votes
0answers
18 views

Use image from internet in MediaMetadataCompat

Hello i am learning android development and i am building a audio player and to handle audio playback i am using this sample audio player from google sample codes. This sample project have class ...
0
votes
0answers
25 views

Android Kotlin : automatically go next Audio . How?

I am going to implement an audio player. I can go next audio by manual clicking. Flow works. but when it comes to implementing this flow to background, my audio player does not work. The Media Plater ...
0
votes
1answer
70 views

MediaPlayer - setAudioAttributes not working properly

I'm trying to create an alarm, everything is working fine but the stream type is always media even tho I use STREAM_ALARM, since setStreamType is deprecated, I'm using setAudioAttributes instead but ...
1
vote
0answers
25 views

Android MediaBrowserService customize audio src and meta data

I am building a audio player i have completed all the Songs browsing (UI) activities and to handle audio playback i am using google sample audio player this and i read all the src from this sample ...
0
votes
2answers
27 views

Why MediaPlayer getDuration() method return -1 on low quality audio?

I updated my app android API-23 to API-28 now MediaPlayer getDuration() method return -1, in api-23 getDuration method working fine but in latest api having issue. when using low quality (i.e 16kbs) ...
0
votes
0answers
20 views

Audio issue in Android version 9

In my android application, I have media player to play audio from server.It works fine in Android version 8 (oreo) and others,but in Android version 9(pie) its not working simply stops playing.please ...
0
votes
0answers
15 views

Why do I get a whitescreen when switching fragments while playing sounds using MediaPlayer

So, when I start playing a song and switch the fragment and the song continues to play. When i switch back after that, i get a fully white fragment. Right now i have three Fragments, but only two of ...
0
votes
0answers
27 views

How to Print Media Files in DESCENDING Order

I am Accessing media files using cursor in a array. But i need to print the array i descending order (Meaning Latest Media File in System First) Cursor cursor = getApplicationContext() ...
0
votes
0answers
33 views

Cannot get next song to play after onCompleteListener

I have read numerous different responses on this matter but I just wanted to clarify one thing about the onCompletionListener method for MediaPlayer. I have a configuration that is currently working ...
0
votes
1answer
28 views

Why MediaPlayer does not play the audio correctly?

I am working in a gallery of images that include an audio of how the things that the user is viewing on the screen are pronounced, which is executed with a button also included in the screen. The ...
0
votes
0answers
19 views

How to create my own callback-method of MediaControllerCompat

I'm developing simple music player which have client-server architecture(there is MediaControllerCompat object in Activity that sends callbacks to MediaSessionCompat in the MusicService). I need to ...
0
votes
1answer
24 views

How to clear the current MediaPlayer playlist?

I need to clear current playlist, when a user choose another playlist. When I choose another playlist, method onChildrenLoaded() called and there is some code, but it's problem, because this method ...
0
votes
0answers
16 views

Modify an existing MediaDescriptionCompat object without creating a new MediaDescriptionCompat.Builder()

I'm able to create a new MediaDescriptionCompat object from scratch using the specific method .build(), e.g.: MediaDescriptionCompat.Builder b = new MediaDescriptionCompat.Builder(); b....
0
votes
0answers
18 views

Can I set a preferred Audio Device in Exoplayer or MediaPlayer for video playback?

For the most part it seems this is handled using system default device. Is there a way, like in AudioTrack.setPrerredDevice(AudioDeviceInfo info) in ExoPlayer/ MediaPlayer to manually set the output ...
0
votes
0answers
6 views

Media button event pass through on my onMediaButtonEvent

I develop application which remapping headset's media button. So, I use "onMediaButtonEvent" API for hooking all of my headset's event and change original event to new event what user customized. It ...
0
votes
0answers
16 views

Typewriter text animation - how to play sound until the animation ends?

I'm working on Android application which shows random text string from ArrayList & plays short sound clip with MediaPlayer, on button click. The text is shown in animation which mimics typewriter (...