4

The code runs fine but way am I geting this Erro log

Erro log:

08-28 08:44:24.281: E/MediaPlayer(32454): mOnVideoSizeChangedListener is null. Failed to send MEDIA_SET_VIDEO_SIZE message.

I try to convert the audio file to different format set up listeners and so on ... I really need a help with this one. Her is the whole MediaPlayer Log:

Log:

08-28 08:44:24.121: V/MediaPlayer-JNI(32454): native_setup
08-28 08:44:24.131: V/MediaPlayer(32454): constructor
08-28 08:44:24.146: D/dalvikvm(32454): GC_CONCURRENT freed 193K, 4% free 9397K/9735K, paused 2ms+2ms
08-28 08:44:24.146: V/MediaPlayer-JNI(32454): native_finalize
08-28 08:44:24.146: V/MediaPlayer-JNI(32454): release
08-28 08:44:24.146: V/MediaPlayer-JNI(32454): native_finalize
08-28 08:44:24.146: V/MediaPlayer-JNI(32454): release
08-28 08:44:24.186: V/MediaPlayer(32454): setListener
08-28 08:44:24.186: V/MediaPlayer-JNI(32454): setDataSourceFD: fd 47
08-28 08:44:24.186: V/MediaPlayer(32454): setDataSource(47, 740, 14519)
08-28 08:44:24.216: V/MediaPlayer(32454): setVideoSurfaceTexture
08-28 08:44:24.216: V/MediaPlayer(32454): prepare
08-28 08:44:24.246: V/MediaPlayer(32454): message received msg=5, ext1=0, ext2=0
08-28 08:44:24.246: V/MediaPlayer(32454): New video size 0 x 0
08-28 08:44:24.246: V/MediaPlayer(32454): callback application
08-28 08:44:24.246: V/MediaPlayer(32454): back from callback
08-28 08:44:24.246: V/MediaPlayer(32454): message received msg=1, ext1=0, ext2=0
08-28 08:44:24.246: V/MediaPlayer(32454): prepared
08-28 08:44:24.246: V/MediaPlayer(32454): signal application thread
08-28 08:44:24.246: V/MediaPlayer(32454): callback application
08-28 08:44:24.246: V/MediaPlayer(32454): back from callback
08-28 08:44:24.246: V/MediaPlayer(32454): prepare complete - status=0
08-28 08:44:24.246: V/MediaPlayer-JNI(32454): start
08-28 08:44:24.246: V/MediaPlayer(32454): start
08-28 08:44:24.281: E/MediaPlayer(32454): mOnVideoSizeChangedListener is null. Failed to send MEDIA_SET_VIDEO_SIZE message.
08-28 08:44:24.281: I/MediaPlayer(32454): Don't send intent. msg.arg1 = 0, msg.arg2 = 0
08-28 08:44:24.281: E/MediaPlayer(32454): mOnPreparedListener is null. Failed to send MEDIA_PREPARED message.
08-28 08:44:25.661: V/MediaPlayer(32454): message received msg=2, ext1=0, ext2=0
08-28 08:44:25.661: V/MediaPlayer(32454): playback complete
08-28 08:44:25.661: V/MediaPlayer(32454): callback application
08-28 08:44:25.661: V/MediaPlayer(32454): back from callback
08-28 08:44:25.666: E/MediaPlayer(32454): mOnCompletionListener is null. Failed to send MEDIA_PLAYBACK_COMPLETE message.
08-28 08:49:24.211: V/MediaPlayer-JNI(32454): release
08-28 08:49:24.211: V/MediaPlayer(32454): setListener
08-28 08:49:24.211: V/MediaPlayer(32454): disconnect
08-28 08:49:24.226: V/MediaPlayer(32454): destructor
08-28 08:49:24.226: V/MediaPlayer(32454): disconnect

And Java code.

Java code:

 public class MainActivity extends Activity {
    MediaPlayer TestingAudio;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        Initialization();
        DoStuff();
    }

    private void Initialization() {
        setContentView(R.layout.activity_main);
        TestingAudio = MediaPlayer.create(MainActivity.this, R.raw.samlagnin);
    }

    private void DoStuff() {
        TestingAudio.start();
    }

    @Override
    protected void onPause() {
        super.onPause();
        TestingAudio.release();
        TestingAudio = null;
    }
Gudrodur
  • 55
  • 1
  • 7

3 Answers3

2

I managed to get rid of the errors by attaching some empty listeners. See setOnPreparedListener() and similiar methods at http://developer.android.com/reference/android/media/MediaPlayer.html

magritte
  • 7,396
  • 10
  • 59
  • 79
  • I have a similar question,but with video,not audio (same media player, however). I believe that this is important, not merely harmless error log messages. I think it is very harmful (and can prove it, if you like). I would love to stub off the callbacks--however--I can't locate the `MediaPlayer` without reflection. How did you locate the MP (the to which you presumably attached your excellent code above when you completed testing it)? http://stackoverflow.com/questions/12418014/android-webview-playing-html5-h-264-mp4-video-how-to-get-at-the-mediaplayer – Ted Collins Nov 20 '12 at 12:29
0

Do you mean aac? But MediaPlayer does not support aac.

wodong
  • 297
  • 2
  • 10
  • I did mean aac sorry :P but they say it her http://developer.android.com/guide/appendix/media-formats.html I am confused so what format should I use? – Gudrodur Aug 28 '12 at 11:43
  • @Gudrodur That's OK. :) Did you use Android3.1+ to run the test code? – wodong Aug 28 '12 at 11:50
  • Maybe you can provide me the aac file, then I can test it on my machine. – wodong Aug 28 '12 at 12:07
  • I tried your aac file. If I install the test apk on my phone(Android4.0), no error log found and I can hear the sound. But if I install the test apk on phone simulator(Android4.1), then I got an error java.io.IOException: setDataSourceFD failed. I also tried another mp3 file to test on my simulator and the result is fine. So I guest maybe there is something wrong with this aac file(not complete?) when you saw those error logs. – wodong Aug 28 '12 at 14:52
  • thank you for the help. I am going to try make a fresh audio recording and see if I stop getting those errors. – Gudrodur Aug 28 '12 at 15:01
  • @Gudrodur I'm seeing the same issue running ICS, did you find a solution? I'm using .ogg format for the sound files. – magritte Sep 23 '12 at 08:47
  • @Tony I think it is not a issue. I think this is just how the mp works it try to call video listeners and so on when tho the file is just audio. I wold like to be able to overwrite this but it not possible. – Gudrodur Sep 24 '12 at 09:40
  • @Gudrodur I've added my own answer - I found you can remove these errors by setting a listener. – magritte Sep 24 '12 at 10:13
0

Do I understand it right, that your app works and you're only wondering about the logged errors? I think that MediaPlayer simply tries to invoke all defined callback methods, regardless of the concrete file/codec. As you can see in your logfile there are several other callbacks that are null too, like mOnCompletionListener and mOnPreparedListener. So I wouldn't be worried too much about that.

Ridcully
  • 23,362
  • 7
  • 71
  • 86
  • yes I am just wondering about the logged errors. I should maybe not worry about it. It just bugs me and I have spent lot of time trying to find out way lol – Gudrodur Aug 28 '12 at 12:31