I am working on an app in which an audio file (boo.wav) is being played. The audio does however not play and generates some error output.
When trying to execute the following line:
MediaPlayer.create(this, R.raw.boo).start();
I get the following errors:
E/MediaPlayer﹕ Should have subtitle controller already set
E/MediaPlayer﹕ error (1, -19)
E/MediaPlayer﹕ Should have subtitle controller already set
E/MediaPlayer﹕ Error (1,-19)
Can someone point me in a general direction as to what I am doing wrong?
Related
I'm desperate, I work with MediaPlayer and I would just pause the player.
But when I try to pause the player, I got error (-38, 0).
And in log : pause called in state 8.
I know this error would mean I try to pause the player when it isn't started. But my code is :
if (mediaMusic.isPlaying()) {
Log.d("GREG", "Media music is playing");
mediaMusic.pause();
Log.e("GREG", "Media music paused");
}
But in logs :
D/GREG: Media music is playing
V/MediaPlayer-JNI: pause
V/MediaPlayer: pause
E/MediaPlayer: pause called in state 8, mPlayer(0x7546266e00)
V/MediaPlayer: message received msg=100, ext1=-38, ext2=0
E/MediaPlayer: error (-38, 0)
V/MediaPlayer: callback application
V/MediaPlayer: back from callback
E/GREG: Media music paused
So if somebody has an idea to resolve this issue it will be beautiful !
Thanks !
EDIT : I've just see the problem is only present when I set the speed of MediaPlayer like that
mediaMusic.setPlaybackParams(mediaMusic.getPlaybackParams().setSpeed(rate));
But I have to change the speed, so the problem is still unsolved ...
So, I have an app that I'm trying to get to loop a bunch of video portraits at the bottom. It works perfectly on the emulator (Android 4.1) and seemed to work on my phone (7.1).
On the device I need to deploy the app to (an old android 4.0 TV box) the videos appear black, or start showing something and then go to black shortly after.
I tried an emulator of 4.0 and it seems to be doing the same thing, but I can't figure out why and searches for the error codes it's shooting out don't pull up anything.
It loops through all the portraits and creates video views like this:
`
VideoView video = new VideoView(context);
boolean failure = false;
Log.d("videoPlayer", "Playing video: " + Environment.getExternalStorageDirectory()+"/reviews/" + localPortraits[i]);
video.setVideoPath(Environment.getExternalStorageDirectory()+"/reviews/" + localPortraits[i]);
video.setOnErrorListener(new MediaPlayer.OnErrorListener(){#Override
public boolean onError(MediaPlayer nmp, int what, int extra){
Log.d("MediaPlayer", "CAUGHT ERROR. ReDownload");
badMovie(nmp.toString());
return true;
}
});
video.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
#Override
public void onPrepared(MediaPlayer mp) {
mp.start();
mp.setLooping(true);
}
});
frame.addView(video);
}`
And again, running in the 4.1 emulator it works beautifully. When I put it on the 4.0 TV or 4.0 emulator, it shoots out this:
W/MediaPlayer: info/warning (8004, 0)
I/MediaPlayer: Info (8004,0)
W/MediaPlayer: info/warning (8004, 0)
I/MediaPlayer: Info (8004,0)
W/MediaPlayer: info/warning (8004, 0)
I/MediaPlayer: Info (8004,0)
I/VideoView: MediaPlayer:AMLOGIC_PLAYER Prepared
D/MediaPlayer: getMetadata
I/VideoView: Layout changed,left=3 top=3 right=80 bottom=140
I/VideoView: Layout changed,oldLeft=3 oldTop=3 oldRight=81 oldBottom=140
I/VideoView: .left=3.top=3.right=80.bottom=140.oldLeft=3.oldTop=3.oldRight=81.oldBottom=140.Rotation=0
I/VideoView: MediaPlayer:AMLOGIC_PLAYER Prepared
D/MediaPlayer: getMetadata
E/MediaPlayer: error (1, -33554484)
E/MediaPlayer: error (1, -1)
I/VideoView: MediaPlayer:AMLOGIC_PLAYER Prepared
D/MediaPlayer: getMetadata
E/MediaPlayer: error (1, -33554484)
E/MediaPlayer: error (1, -1)
Plus a ton more along the same lines.
What am I doing wrong that it won't run on Android 4.0?
I tried to play a video with the code below. However, I get the classic error of 'Can't play this video' pop-up at run time. I did my due diligence in searching the android literature and looking through other people's questions, but I can't seem to find the problem a) because no where in the documentation can I find the error code (1 ,-38) for MediaPlayer and b) my video meets the specifications required for android media formats (h.264 and MPEG-4). If anyone can help point me in the right direction I'd really appreciate it! Thanks
private void startVideo() {
Log.v(TAG, "videoUrl = " + mVideoUrl);
Uri uri = Uri.parse(mVideoUrl);
mVideo = (VideoView) getView().findViewById(R.id.preview_videoView);
MediaController mediaController = new MediaController(getActivity());
mediaController.setAnchorView(mVideo);
mVideo.setMediaController(mediaController);
mVideo.setVideoURI(uri);
mVideo.start();
}
These are the logs
10-07 21:08:38.529 9986-9986/com.trainwithtanya.hiitandroid V/﹕ videoUrl = http://files.parsetfss.com/2bb9a4a0-9f35-4124-a634-d2fa7f8b165e/tfss-ca535209-4b4c-4022-95b8-8f011ed41daf-High%20Knees.mp4
10-07 21:08:38.579 9986-10011/com.trainwithtanya.hiitandroid W/EGL_emulation﹕ eglSurfaceAttrib not implemented
10-07 21:08:38.579 9986-10011/com.trainwithtanya.hiitandroid W/OpenGLRenderer﹕ Failed to set EGL_SWAP_BEHAVIOR on surface 0xa5245c20, error=EGL_SUCCESS
10-07 21:08:38.609 9986-9986/com.trainwithtanya.hiitandroid D/MediaPlayer﹕ Couldn't open file on client side, trying server side
10-07 21:08:39.582 9986-9986/com.trainwithtanya.hiitandroid D/MediaPlayer﹕ getMetadata
10-07 21:08:39.637 9986-9999/com.trainwithtanya.hiitandroid E/MediaPlayer﹕ error (1, -38)
10-07 21:08:39.637 9986-9986/com.trainwithtanya.hiitandroid E/MediaPlayer﹕ Error (1,-38)
10-07 21:08:39.637 9986-9986/com.trainwithtanya.hiitandroid D/VideoView﹕ Error: 1,-38
10-07 21:08:39.650 9986-10000/com.trainwithtanya.hiitandroid E/MediaPlayer﹕ error (1, -38)
10-07 21:08:39.702 9986-9986/com.trainwithtanya.hiitandroid E/MediaPlayer﹕ Error (1,-38)
10-07 21:08:39.702 9986-9986/com.trainwithtanya.hiitandroid D/VideoView﹕ Error: 1,-38
Here is the video format
http://i288.photobucket.com/albums/ll185/akhan007/mediaType_zpsjfvfdpto.png
I think, you need call mVideo.start(); inside onPrepare
mVideo.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
public void onPrepared(MediaPlayer mp) {
mVideo.start();
}
});
I have a problem with video not been playing. I am using SurfaceView with MediaPlayer.
Those are my actions:
MediaPlayer.setDataSource(url)
MediaPlayer.prepareAsync();
MediaPlayer.start() // From setOnPreparedListener listener
MediaPlayer.reset()
Go back to 1 with different url
About 3 out of 5 videos do not start playing. I see nothing in the logs except some times when video does start it show me this:
W/MediaPlayer﹕ info/warning (1, 903)
Can't find 903 in the documentations.
I want to play mp3 radio stream using Android MediaPlayer via http protocol. From time to time [1 playing of 5 - that is actually quite often] I receive PVMFFailure like this:
02-23 02:05:23.503: ERROR/PlayerDriver(91): Command PLAYER_INIT completed with an error or info PVMFFailure
02-23 02:05:23.503: ERROR/MediaPlayer(2111): error (1, -1)
02-23 02:05:23.533: ERROR/MediaPlayer(2111): stop called in state 0
02-23 02:05:23.533: ERROR/MediaPlayer(2111): error (-38, 0)
There is no solution here or on google, so please if you do know how to debug this, please help :)
Here is my code for player:
//start
MediaPlayer player = new MediaPlayer();
player.setAudioStreamType(AudioManager.STREAM_MUSIC);
player.setDataSource(address);
player.prepare();
player.start();
//stop
player.stop();
player.reset();
I`m using Android 2.2 API. Thanks!
You should use player.prepareAsync(); instead player.prepare();.