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
40
votes
7 answers

Simple mediaplayer play mp3 from file path?

I have a very simple mediaplayer that play background. It calls file from the apk, but I want it to play from any directory like as music or sdcard. Here is my code: private MediaPlayer mpintro; . . mpintro = MediaPlayer.create(this,…
John simit
  • 1,305
  • 2
  • 11
  • 14
40
votes
3 answers

Setting data source to an raw ID in MediaPlayer

In MediaPlayer.create method an id to a Raw file can be used but how to use that in setDataSource method?
russoue
  • 5,180
  • 5
  • 27
  • 29
38
votes
7 answers

MediaPlayer.setDataSource(String) not working with local files

I am able to play a local mp3 if I use the static method MediaPlayer.create(context, id) but it's not working if I use the non-static method MediaPlayer.setDataSource(String). What's happening is that I am getting a synchronous exception when I…
user755921
37
votes
5 answers

MediaPlayer : Should have subtitle controller already set: KitKat

I am having an odd issue where my audio file sometimes plays and sometimes does not play. The catch is that when it decides to not play, the DDMS gives me an: E/MediaPlayer﹕ Should have subtitle controller already set Because this is one-to-one…
bneigher
  • 818
  • 4
  • 13
  • 24
35
votes
2 answers

ExoPlayer and start / pause / seekTo commands

I am trying to use ExoPlayer, as opposed to MediaPlayer and I can't seem to figure it out... MediaPlayer has .start() / .pause() commands... and I can just seekTo(1287) and it automatically starts playing... How do I do this with ExoPlayer? I have…
DeNitE Appz
  • 1,003
  • 2
  • 12
  • 18
35
votes
2 answers

Forcing Android to use RTSP/AVP/TCP interleaved

I am using Android 4.1.2 on Galaxy S3. Currently android mediaplayer always tries RTSP UDP (RTP/AVP/UDP) method to connect with RTSP server. If Android MediaPlayer does not receive the data on its UDP ports..it timesout and then tries RTSP TCP…
ext123
  • 351
  • 3
  • 3
34
votes
3 answers

Complete list of MediaPlayer error codes

I'm implementing a MediaPlayer. Everything goes smoothly BUT each time I encounter a new error it can be very hard to find its meaning. The official doc is lacking in that area, so a website like stack overflow is the only solution and this time…
Teovald
  • 4,369
  • 4
  • 26
  • 45
34
votes
1 answer

What in TtsService could explain the lack of onUtteranceCompleted() for playEarcon()?

A while ago, I discovered that playEarcon() never produces onUtteranceCompleted(). At the time I just interpreted the documentation that said "Called when an utterance has been synthesized" as onUtteranceCompleted() being not applicable for earcons…
an00b
  • 11,338
  • 13
  • 64
  • 101
33
votes
2 answers

MediaPlayer stutters at start of mp3 playback

I've been having a problem playing an mp3 file stored in a raw resource: when the file first starts playing, it generates perhaps a quarter of a second of sound and then restarts. (I know that this is basically a duplicate of the problem described…
Ted Hopp
  • 232,168
  • 48
  • 399
  • 521
33
votes
5 answers

Why MediaPlayer throws NOT present error when creating instance of it?

When creating an instance of MediaPlayer LogCat shows this error: QCMediaPlayer mediaplayer NOT present Why is that and is it normal? Sample: package com.example.testapp; import android.app.Activity; import android.media.MediaPlayer; import…
antifriz
  • 873
  • 2
  • 13
  • 20
32
votes
8 answers

How to mute MediaPlayer in android

How to mute MediaPlayer in android
Parag Chauhan
  • 35,760
  • 13
  • 86
  • 95
32
votes
7 answers

How do I get the current volume/amplitude in a MediaPlayer?

I'm working on an app that will both record an audio file, and then have the option to play back that file once it's been recorded. The UI has an EQ component that animates relative to the current amplitude of the recording. I've got the animation…
Scott Ferguson
  • 869
  • 1
  • 9
  • 17
31
votes
3 answers

VideoView getCurrentPosition() irregularity on Acer Iconia A200

I have an application with a VideoView in it, I set a video to play in the VideoView. At some point while the video is playing it will get paused. Then after it is paused for some time it will begin to play the video again, but seek forward to the…
FoamyGuy
  • 46,603
  • 18
  • 125
  • 156
30
votes
4 answers

Android ExoPlayer : Does it solve gapless / seamless playback issue that is broken for the Android Media Player

Has anyone tried using ExoPlayer to achieve this? I tried looking online with no success. When I say gapless playback, I am referring to the problem of using the media player to play local videos back to back. After the first video is done…
29
votes
1 answer

Music player control in notification

how to set notification with play/pause, next and previous button in android.! I am new with Android & also at stack overflow. So please bear with me. I set notification when song is start to play like below : ` @SuppressLint("NewApi") public void…