33

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 android.os.Bundle;



public class MainActivity extends Activity{


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        MediaPlayer mediaPlayer = new MediaPlayer();
    }
}
antifriz
  • 873
  • 2
  • 13
  • 20

5 Answers5

18

It means your platform does not support QCMediaPlayer. QCMediaPlayer provides extended APIs and interfaces to get and set MPD attributes for DASH protocol in compatible Snapdragon builds. So, this error should not affect on media playing in normal case

Check this sources to find out more details:

QCMediaPlayer.java

alexuz
  • 778
  • 6
  • 6
  • 3
    If the platform doesn't support QCMediaPlayer, why would it try to launch QCMediaPlayer? – iheanyi Feb 27 '15 at 15:30
  • 25
    And why does the Android operating system allow this and that app, as well as itself, to throw out error messages in the first place? Shouldn't that be removed completely in a commercially launched system that should be out of debug mode? – carl Mar 05 '15 at 13:15
  • 4
    This should not be accepted; it gives no information on how to solve this problem, which is that on some platforms MediaPlayer is totally non-functional. – Shawn Lauzon May 13 '16 at 20:40
  • 1
    Is there any solution to prevent QCMediaPlayer from being invoked in the first place? – hybrid Jun 08 '16 at 07:54
  • 2
    What your mean "your platform" ? – Fortran Oct 16 '17 at 15:00
  • What is the 'normal case'? Can these errors be safely ignored? – lucidbrot Jan 07 '19 at 12:53
8

I know that this is not an answer for "Why" this is happening but if someone wants to make it work (at least for me it worked), you can initialize the MediaPlayer not by creating a new instance and setting the data source but by creating it using the static method create:

MediaPlayer player = MediaPlayer.create(this, Uri.parse(sound_file_path));

or

MediaPlayer player = MediaPlayer.create(this, soundRedId, loop);
David Silva-Barrera
  • 1,006
  • 8
  • 12
MikeL
  • 5,385
  • 42
  • 41
2

adding mMediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC); solved problem for me. Initially I tried with other types however it didn't work.

ᴛʜᴇᴘᴀᴛᴇʟ
  • 4,466
  • 5
  • 39
  • 73
Harsh Chhabra
  • 29
  • 1
  • 5
1

Bizarrely, what seemed to fix this for me is restarting Android Studio. Then I ran in debug mode and it started working, and haven't seen the error since. Weird!

Shawn Lauzon
  • 6,234
  • 4
  • 35
  • 46
1

I have added this code:

MediaPlayer mediaPlayer = MediaPlayer.create(MainActivity.this,R.raw.menumusic);
mediaPlayer.start();

And it was not working, what seemed to fix this for me is restarting Android Studio.
Hope this will help someone.

Pang
  • 9,564
  • 146
  • 81
  • 122
Roga Men
  • 512
  • 6
  • 16