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
0 answers

Display the album cover of an Audio file with Kotlin - Android

I've seen a lot of people ask questions related to this, but they were all written in Java and they all use the method getContentResolver().loadThumbnail(imageUri, thumbSize, null);, but how to use loadThumbnail() in Kotlin? Here is my…
Aiden
  • 11
  • 2
1
vote
2 answers

when Playing the video background, report android.view.WindowManager$BadTokenException:Unable to add window-token null is not valid;

I am trying to play videos in VideoView in the recyclerView using realTime database. Here is my adapter code of the recyclerView. :- class VideoAdapter(private var mContext: Context,private var mvideos: List) :…
1
vote
1 answer

error -19,0 from using Mediaplayer?

E/MediaPlayer(20473): error (-19, 0) I/MyApp (20473): Decoding lala.mp3 I/StagefrightPlayer( 68): setDataSource('mypath') E/AudioFlinger( 68): no more track names available E/AudioTrack( 68): AudioFlinger could not create track, status:…
Sith
  • 105
  • 1
  • 4
  • 11
1
vote
0 answers

Change file used in a sound service programmatically

I'm using the BackgroundSoundService for playing music in a background of my activity. However, when I switch to another activity, I would like to use another sound. This is how my class looks like. I need to change that "R.raw.sound"…
sznn
  • 11
  • 1
1
vote
4 answers

Stop media player

I am new in android and I have another (simple?) problem. I don't know how to stop Media Player. This is my simple code: public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); …
jundymek
  • 1,013
  • 4
  • 18
  • 40
1
vote
1 answer

Wear OS Tiles: How would one update UI dynamically

So I am working to build media tile, but whenever I play the a next song and use getUpdater(applicationContext).requestUpdate(MyTileService::class.java) it take few seconds before it refreshes the tile, so the next song starts but, the…
1
vote
1 answer

MediaPlayer on Android Wear OS. Why do I get a IOException after prepare. Prepare failed status=0x1

I would like to create an app on Wear OS which plays back an online stream. The following code works fine under Android but not on Android Wear OS. Does anyone has an idea, why I get the Prepare failed status. MediaPlayer…
1
vote
1 answer

Detecting stop event of android media player

I want to detect the stop event of android music player. I am actually calling a method when the file stops playing. There is an isPlaying method, but in order to get the stop event, I need to put it inside a while loop which might induce…
Brahadeesh
  • 2,245
  • 8
  • 40
  • 58
1
vote
0 answers

Android media player stops at last song

Hi how can I make the mediaplayer continue after it plays the last song in a listview? `mediaPlayer.setOnCompletionListener(new MediaPlayer.OnCompletionListener() { @Override public void onCompletion(MediaPlayer mediaPlayer)…
1
vote
0 answers

How to get MediaMetadataCompat from an specific single File

I'm creating an application where you can play all .wav files using the Media App Architecture. So while user is listening a song, internally app is creating the reverse file of the song and save it in an specific path. It's working…
1
vote
1 answer

Playing a WMA in my android app

Simple question: I'm using MediaPlayer to play mp3 files (they play just fine), but also i need support for WMA files. I know some devices support it, but not all of them, but i want some way where I'm sure it will play in any device. Is there…
Ale K.
  • 316
  • 6
  • 18
1
vote
1 answer

Issues in migrating older ExoPlayer API code to version 2.16.1

I have the following code using ExoPlayer 2.4.0 API that simply plays a video. I was trying to migrate it to the latest API version (2.16.1), but many of the APIs and my used code don't work there anymore. For instance, newSimpleInstance() isn't…
Tina J
  • 4,983
  • 13
  • 59
  • 125
1
vote
2 answers

How I should know that the app is in not running?

I have an android app that starts playing music right after the splash screen all the time while the user interacts with the app, using a singleton class for MediaPlayer, which is working perfectly, but I want to stop the music when the app exits or…
Ali Tamoor
  • 896
  • 12
  • 18
1
vote
0 answers

YouTube url extractor with Android player. HD videos stuffer and buffers even on fast internet

We are facing challenges in the YouTube player. HD videos stuffer and buffers even on fast internet. All videos that result from search "HD videos" are buffering. Implementation how? We get streaming URL by using extractor i.e. youtubeExtractor ,…
Qamar
  • 4,959
  • 1
  • 30
  • 49
1
vote
1 answer

Problem to Manipule MediaPlayer in MainActivity

I'm with a noob problem and I need your help, I even tried to use Singleton Pattern, but nothing :( Show you my code below: This is a class called VideoItemAdapter who extends RecyclerView.Adapter Here my code: from…