Android MediaPlayer Error (-38,0) - android

I got a problem with my media player. Sometimes an error occurs and the on error is called. There I have the Mediaplayer and two int as parameters.
The first int is "-38" and the second one is "0".
What does that mean?
EDIT: Code: http://pastebin.com/3XBaFYwF
Here's my logcat #Blundell LogCat:
http://pastebin.com/Wbjm3QCW

error 38 means you are asking the MediaPlayer to do something when in the wrong state. You won't be able to fathom your error just from this.
Look at your Logcat before and after this error code and see what else has gone wrong. It's more than like you are calling start before the MediaPlayer has prepared or some other error of state.
see http://developer.android.com/reference/android/media/MediaPlayer.html#StateDiagram

Related

Android MediaPlayer Error (-2,0)

Anyone familiar with this error with Android MediaPlayer ?
MediaPlayer: Error (-2,0)
It's not documented.
It probably comes from OpenCore, which MediaPlayer is a high level abstraction of. "-2" means that some operation was canceled.
Here the list of error codes.
/*
Error due to cancellation
*/
const PVMFStatus PVMFErrCancelled = (-2);
Here is the doc with the detailed code description.
3.8. PVMFErrCancelled
This error code is returned when some old request is cancelled. In that sense this error is actually
an expected value and should not be treated as a fatal error.
So, you may probably ignore it, or double check how you implemented the workflow and whether it fits the expected one (you can find it in MediaPlayer class' reference).
From MediaErrors.h, include/utils/Errors.h, and unix_system_errors we can see that MediaPlayer error code -2 can mean:
Signal from CodecBase to MediaCodec that the component was not found.

Unclear error when playing a video in a VideoView

I'm trying to play a video (by a uri) in a VideoView and sometimes get the following errors:
E/MediaPlayer(15861): error (1, -2147483648)
D/MediaPlayer(15861): Couldn't open file on client side, trying server side
W/MediaPlayer(15861): mediaplayer went away with unhandled events
I found that the "list" of codes can be found in the following source code:
https://github.com/android/platform_external_opencore/blob/master/pvmi/pvmf/include/pvmf_return_codes.h
(thanks to the thread Complete list of MediaPlayer error codes)
But that does not make things more clear, there's nothing there about -2147483648, and the 1 I get is positive and in this source it says that error codes are negative.
Same thing was reported in this thread: Playing youtube video in a videoview, though he did not ask about what this error means (nor did he get any helping answer).
Anyone has an idea of the meaning of this error?
Thanks.
Edit
I'm trying to show youtube videos, the url of the stream is taken from http://www.youtube.com/get_video_info?&video_id=VIDEO_ID and it's being done asynchronously.
When the result gets back, this is the code I'm using:
activity.runOnUiThread(new Runnable() {
#Override
public void run() {
setVideoURI(videoStream);
}
});
This is being executed by a class which extends VideoView.
1 stand for MEDIA_ERROR_UNKNOWN. and -2147483648 is a myth
Refer to the documentation for further details.
This kind of error occurs when trying to play an invalid url. Assuming you are not using third party libraries.

stop called in an invalid state: 1

I am trying to build a call recorder in android. I am using the MediaRecorder Class:
When My App reaches the following line: recorder.stop() I get the following error:
stop called in an invalid state: 1
What causes that problem?
Thanks in advance,
kobi
From the MediaRecorder documents page:
http://developer.android.com/reference/android/media/MediaRecorder.html
Looking at the state diagram given, you can only call stop() when the MediaRecorder is in the state Recording
Hard to tell what you are doing wrong without code, but you have to be in the wrong state to call stop().

mediaPlayer prepare nullpointer exception

it's realy rare error for me but.. It's error. Can't understand why.
error just on line
mp.prepare();
from logcat :
Caused by: java.lang.NullPointerException
at myapp.activity.com.myApp.media(myApp.java:281)
at myapp.activity.com.myApp$showLogotype.doInBackground(myApp.java:397)
at myapp.activity.com.myApp$showLogotype.doInBackground(myApp.java:1)
at android.os.AsyncTask$2.call(AsyncTask.java:185)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305
Someone can explain me :( ?
Im using asynctask for prepare and load all datas and showing logo while my app reading datas and preparing for mediaPlayer( in logcat : mediaPlayer.prepare() getting 5-10 seconds) )
But im sometimes have this realy rare error for me(cos i can't understand how to get this error and he is realy rare for me)
Please explain me if anyone know :( or please< tell me how to fix this :(
code of function :
public void media() throws IllegalArgumentException, IllegalStateException, IOException
{
mp = new MediaPlayer();
mp.setDataSource(stream);
mp.prepare();
}
Regards,Peter. Sorry for my bad english, hope u understand me
A null pointer exception happens when you try to access a variable or object that is not properly assigned/instantiated. My guess is that you either have not assigned the media player, or have not given the player the data you want to prepare. Resource: http://developer.android.com/reference/android/media/MediaPlayer.html
Can't catch this problem. I manualy catch and solve for some problem. I think media player have a bug .. .and this problem not fixing.

Regarding IllegalStateExceptions, MediaPlayer, failed prepares and State codes

I have been struggling quite a lot with our beloved MediaPlayer class...
Specifically I want to simply play sounds from some Files...
I am getting two specific types of errors actually, and not continuesly but it seems like random... Sometimes 10 files are played rigth away with no errors, then the MediPlayer seems to stop accepting another File...
Ok the first error :
- 05-26 15:02:00.916: ERROR/MediaPlayer(25793): error (1, -4)
- 05-26 15:02:00.916: ERROR/setupplayer(25793): java.io.IOException: Prepare failed.: status=0x1
Well for this one I have seen several solutions :
use
mp.setDataSource(ins.getFD()); (with ins being an inputstream to my File)
and/or to use
mp.setDataSource(ins.getFD(), 0, f.length());
Both unfortunately won't solve the problem, and I would simply LOVE to know what the very exhaustive error(1,-4) is... And where can I find the codes of the States of the MediaPlayer ?
Also I have tried using prepareAsync() instead of prepare() but to be honest it doesn't seem to make any difference at all..
The second error is the Exception which is thrown :
05-26 15:17:30.456: ERROR/playNextPlayer(27303): Error caught : java.lang.IllegalStateException
Which, I guess, might be related to the first error/problem ?
Try mp.setDataSource(String path)
For example,mp.setDataSource("sdcard/1.mp3");
The error is coming because of incorrect path or FileDescriptor.
You should check the State Diagram of Mediaplayer class

Categories

Resources