Android Video stops playing after several plays Error 1, 2147483648

Ok, this is a little disappointing, and I was looking for Stack, but none of the answers help.

I have an Android app that cycles through various content on the screen. At one point, it plays a video, the same video downloaded from the same place.

After a random number of plays, he decides to stop playing the video file and throws an error above (-2147483648), which is a common error of the file not found / irregular in shape.

The problem is that the video plays correctly many times before this error occurs. I tried a number of alternatives to fix this:

  • VideoView playing a file (start)
  • The combined reading of MediaPlayer + SurfaceView from a file
  • Reading MediaPlayer + SurfaceView from a file descriptor
  • forcing read permissions in the world
  • copying the file to a temporary file and playing it back
  • manually release the media player for the VideoView and MediaPlayer parameters
  • start manual garbage collection after each game

and yet, after several games, in the end, he will refuse to play the video.

One change, which may or may not be relevant, is to play in a file descriptor that creates a meta player to prepare the Java I / O Exception, which I think is related, there may be some lock in the file.

The only way to fix this is to reboot the device. Restarting the application does not fix it, and it immediately refuses to play the file.

Here is the VideoView playback code:

// from main activity File afile = new File(btvapp.fileroot,btvapp.getDailyVideo().get("FILENAME")); afile.setReadable(true, false); theVideo = (VideoView) findViewById(R.id.videoViewer); theVideo.requestFocus(); theVideo.setVideoPath(afile.getPath()); theVideo.setOnPreparedListener(this); theVideo.setOnCompletionListener(new MediaPlayer.OnCompletionListener() { @Override public void onCompletion(MediaPlayer mp) { // TODO Auto-generated method stub //mp.release(); theVideo.stopPlayback(); mp.release(); finish(); } } ); theVideo.setOnErrorListener(new MediaPlayer.OnErrorListener() { @Override public boolean onError(MediaPlayer mp, int what, int extra) { finish(); return false; } }); // play on prepared function @Override public void onPrepared(MediaPlayer mp) { // TODO Auto-generated method stub mp.start(); } 

The surface view uses the example of the Android SDK media player almost exactly, but I don’t think it's worth pasting the code, because the error occurs regardless of whether you use the mediaplayer + surfaceview method or the VideoView playback method.

Thoughts? Driving me crazy.

UPDATE . Here's the full log, including the main application and generated video activity

 07-19 18:47:02.844: V/videpath(7232): /mnt/sdcard/Android/data/au.com.nian.bullertv/files/tmpbtag.mp4 07-19 18:47:03.014: I/dalvikvm(7232): threadid=1: recursive native library load attempt (/system/lib/libmedia_jni.so) 07-19 18:47:03.014: D/MtpDeviceJNI(7232): register_android_mtp_MtpDevice 07-19 18:47:03.014: I/dalvikvm(7232): threadid=1: recursive native library load attempt (/system/lib/libmedia_jni.so) 07-19 18:47:03.014: I/dalvikvm(7232): threadid=1: recursive native library load attempt (/system/lib/libmedia_jni.so) 07-19 18:47:03.024: V/MediaPlayerService(87): Client(56) constructor 07-19 18:47:03.024: V/MediaPlayerService(87): Create new client(56) from pid 7232, uid 10043, 07-19 18:47:03.034: V/MediaPlayerService(87): setDataSource(/mnt/sdcard/Android/data/au.com.nian.bullertv/files/tmpbtag.mp4) 07-19 18:47:03.034: V/MediaPlayerService(87): media.amsuperplayer.enable is enabled 07-19 18:47:03.034: V/MediaPlayerService(87): media.amsuperplayer.enable is enabled 07-19 18:47:03.034: V/MediaPlayerService(87): player type = 6 07-19 18:47:03.034: V/MediaPlayerService(87): Create AmSuperPlayer 07-19 18:47:03.034: V/AmSuperPlayer(87): [AmSuperPlayer::74] 07-19 18:47:03.034: V/AmSuperPlayer(87): [AmSuperPlayer::76] 07-19 18:47:03.034: V/AmSuperPlayer(87): AmSuperPlayer init now 07-19 18:47:03.034: V/AmSuperPlayer(87): [onFirstRef::103] 07-19 18:47:03.034: V/AmSuperPlayer(87): [initCheck::110] 07-19 18:47:03.034: V/AmSuperPlayer(87): [initCheck::112] 07-19 18:47:03.034: V/AmSuperPlayer(87): [setNotifyCallback::455] 07-19 18:47:03.034: V/AmSuperPlayer(87): [hardwareOutput::330] 07-19 18:47:03.034: V/AmSuperPlayer(87): [hardwareOutput::332] 07-19 18:47:03.034: V/AudioSink(87): AudioOutput(112) 07-19 18:47:03.034: V/MediaPlayerService(87): setDataSource 07-19 18:47:03.034: V/AmSuperPlayer(87): [setDataSource::118] 07-19 18:47:03.034: V/AmSuperPlayer(87): [setDataSource::120] 07-19 18:47:03.034: V/MediaPlayerService(87): [56] setVideoSurfaceTexture(0x28290) 07-19 18:47:03.034: V/AmSuperPlayer(87): [setVideoSurfaceTexture::168] 07-19 18:47:03.034: V/AmSuperPlayer(87): [setVideoSurfaceTexture::170] 07-19 18:47:03.034: V/MediaPlayerService(87): [56] setVideoSurfaceTexture(0x29660) 07-19 18:47:03.034: V/MediaPlayerService(87): [56] setAudioStreamType(3) 07-19 18:47:03.034: V/MediaPlayerService(87): [56] prepareAsync 07-19 18:47:03.034: V/AmSuperPlayer(87): [prepareAsync::199] 07-19 18:47:03.034: V/AmSuperPlayer(87): [prepareAsync::202] 07-19 18:47:03.034: V/AmSuperPlayer(87): initThread(7388) started 07-19 18:47:03.034: V/AmSuperPlayer(87): createPlayer 07-19 18:47:03.034: V/AmSuperPlayer(87): Create Amlogic Player 07-19 18:47:03.034: V/AmlogicPlayer(87): AmlogicPlayer constructor 07-19 18:47:03.034: I/AmlogicPlayer(87): media.amplayer.stopbuflevel is not set 07-19 18:47:03.034: V/AmlogicPlayer(87): onFirstRef 07-19 18:47:03.034: I/AmlogicPlayer(87): found 0 not exit player threads,try exit it now 07-19 18:47:03.034: V/AmlogicPlayer(87): initCheck 07-19 18:47:03.034: V/AmSuperPlayer(87): [CreatePlayer::678] 07-19 18:47:03.034: V/AmlogicPlayer(87): setDataSource 07-19 18:47:03.034: V/AmlogicPlayer(87): History mgt old[,0,-1] 07-19 18:47:03.034: V/AmlogicPlayer(87): History mgt [/mnt/sdcard/Android/data/au.com.nian.bullertv/files/tmpbtag.mp4,0,0] 07-19 18:47:03.034: V/AmlogicPlayer(87): setDataSource url=/mnt/sdcard/Android/data/au.com.nian.bullertv/files/tmpbtag.mp4, len=63 07-19 18:47:03.034: V/AmlogicPlayer(87): Set setVideoSurfaceTexture 07-19 18:47:03.034: I/AmlogicPlayer(87): media.amplayer.lpbufferlevel is not set 07-19 18:47:03.034: I/AmlogicPlayer(87): media.amplayer.buffertime is not set 07-19 18:47:03.034: V/AmlogicPlayer(87): prepareAsync 07-19 18:47:03.034: I/AmlogicPlayer(87): media.amplayer.noaudio is disabled 07-19 18:47:03.034: I/AmlogicPlayer(87): media.amplayer.novideo is disabled 07-19 18:47:03.034: V/AmlogicPlayer(87): buffer level setting is:0.001000-0.020000-0.800000 07-19 18:47:03.034: V/AmlogicPlayer(87): prepareAsync,file_name=/mnt/sdcard/Android/data/au.com.nian.bullertv/files/tmpbtag.mp4 07-19 18:47:03.034: I/amplayer(87): LibPlayer version:Version:2.1.0. 07-19 18:47:03.034: I/amplayer(87): LibPlayer git version: 07-19 18:47:03.034: I/amplayer(87): LibPlayer version serial:201000000000000 07-19 18:47:03.034: I/amplayer(87): LibPlayer Last Changed: 07-19 18:47:03.034: I/amplayer(87): LibPlayer Last Build: Tue May 22 17:40:26 HKT 2012 07-19 18:47:03.034: I/amplayer(87): LibPlayer Builer Name: clei 07-19 18:47:03.034: I/amplayer(87): [player_start:enter]p=0x2a98dc black=0 07-19 18:47:03.034: I/amplayer(87): ***player_para=0x112d28,start_param=0x2a98dc 07-19 18:47:03.034: I/amplayer(87): [player_thread_create:70]creat thread success,tid=149280 07-19 18:47:03.034: I/amplayer(87): [player_start:exit]pid = 23 07-19 18:47:03.034: V/AmlogicPlayer(87): Start player,pid=23 07-19 18:47:03.034: I/amplayer(87): pid[23]::enter into player_thread 07-19 18:47:03.034: I/amplayer(87): pid[23]::Init State: mute_on=0 black=0 t_pos:1074106323s read_max_cnt=0 07-19 18:47:03.034: I/amplayer(87): file::::[/mnt/sdcard/Android/data/au.com.nian.bullertv/files/tmpbtag.mp4],len=63 07-19 18:47:03.154: I/amplayer(87): **[update_state]pid:23 status=BEGIN_INIT(last:UNKNOW_STATE) err=0x0 curtime=0 (ms:0) fulltime=0 lsttime=0 07-19 18:47:03.154: I/amplayer(87): **[update_state]abuflevel=0.000 vbublevel=0.000 abufrp=0 vbufrp=0 read_end=0 07-19 18:47:03.154: V/AmlogicPlayer(87): update_process pid=23, current=0,status=[BEGIN_INIT] 07-19 18:47:03.154: V/AmlogicPlayer(87): Playing percent =0,mPlayTime:0,mStreamTime:0 07-19 18:47:03.154: V/AmSuperPlayer(87): [notify::404] 07-19 18:47:03.154: V/AmSuperPlayer(87): [Notify::411] 07-19 18:47:03.154: V/AmSuperPlayer(87): cookie=0x475e0,msg=3,ext1=0,ext2=0 07-19 18:47:03.154: I/amplayer(87): [ffmpeg_open_file] file=/mnt/sdcard/Android/data/au.com.nian.bullertv/files/tmpbtag.mp4,header= 07-19 18:47:03.154: I/amplayer(87): ffmpeg error: Couldn't open input file! ret==ffffffe8 07-19 18:47:03.154: I/amplayer(87): [player_dec_init]ffmpeg_open_file failed(/mnt/sdcard/Android/data/au.com.nian.bullertv/files/tmpbtag.mp4)*****ret=fcffffff! 07-19 18:47:03.154: I/amplayer(87): pid[23]player_thread release0 begin...(sta:0x30001) 07-19 18:47:03.154: I/amplayer(87): [get_pts_video]No codec handler 07-19 18:47:03.154: I/amplayer(87): **[update_state]pid:23 status=ERROR(last:BEGIN_INIT) err=0x3000001 curtime=0 (ms:0) fulltime=0 lsttime=0 07-19 18:47:03.154: I/amplayer(87): **[update_state]abuflevel=0.000 vbublevel=0.000 abufrp=0 vbufrp=0 read_end=0 07-19 18:47:03.154: V/AmlogicPlayer(87): update_process pid=23, current=0,status=[ERROR] 07-19 18:47:03.154: V/AmSuperPlayer(87): [notify::404] 07-19 18:47:03.154: V/AmSuperPlayer(87): [Notify::411] 07-19 18:47:03.154: V/AmSuperPlayer(87): cookie=0x475e0,msg=64,ext1=1,ext2=fcffffff 07-19 18:47:03.154: V/AmSuperPlayer(87): [CreatePlayer::702] 07-19 18:47:03.154: I/AmSuperPlayer(87): media.amplayer.enable is enabled 07-19 18:47:03.154: I/AmSuperPlayer(87): media.stagefright.enable-player is disabled 07-19 18:47:03.154: V/AmSuperPlayer(87): [CreatePlayer::713] 07-19 18:47:03.154: V/AmSuperPlayer(87): Need to creat new player=3 07-19 18:47:03.154: V/AmlogicPlayer(87): stop 07-19 18:47:03.154: I/amplayer(87): [player_stop:enter]pid=23 07-19 18:47:03.154: I/amplayer(87): [player_stop]player_status=30001 07-19 18:47:03.154: I/amplayer(87): [player_stop]pid=23 thread is already stopped 07-19 18:47:03.154: V/AmlogicPlayer(87): AmlogicPlayer destructor 07-19 18:47:03.154: V/AmlogicPlayer(87): release 07-19 18:47:03.154: V/AmlogicPlayer(87): [release::1461] 07-19 18:47:03.154: I/amplayer(87): [player_stop:enter]pid=23 07-19 18:47:03.154: I/amplayer(87): [player_stop]player_status=30001 07-19 18:47:03.154: I/amplayer(87): [player_stop]pid=23 thread is already stopped 07-19 18:47:03.154: I/amplayer(87): [player_exit:enter]pid=23 07-19 18:47:03.154: I/amplayer(87): [player_exit]player_state=0x30001 07-19 18:47:03.154: I/amplayer(87): [player_stop:enter]pid=23 07-19 18:47:03.154: I/amplayer(87): [player_stop]player_status=30001 07-19 18:47:03.154: I/amplayer(87): [player_stop]pid=23 thread is already stopped 07-19 18:47:03.154: I/amplayer(87): [player_thread_wait_exit:80]pid=[23] thead_id=149280 07-19 18:47:03.154: V/AmlogicPlayer(87): Player status:ERROR, error occur 07-19 18:47:03.154: V/AmSuperPlayer(87): [notify::404] 07-19 18:47:03.154: V/AmSuperPlayer(87): [Notify::411] 07-19 18:47:03.154: V/AmSuperPlayer(87): cookie=0x475e0,msg=64,ext1=1,ext2=ffffffff 07-19 18:47:03.154: I/amplayer(87): **[update_state]pid:23 status=EXIT(last:ERROR) err=0x0 curtime=0 (ms:0) fulltime=0 lsttime=0 07-19 18:47:03.154: I/amplayer(87): **[update_state]abuflevel=0.000 vbublevel=0.000 abufrp=0 vbufrp=0 read_end=0 07-19 18:47:03.154: V/AmlogicPlayer(87): update_process pid=23, current=0,status=[EXIT] 07-19 18:47:03.154: V/AmlogicPlayer(87): Player status:EXIT, playback exit 07-19 18:47:03.154: I/amplayer(87): pid[23]::stop play, exit player thead!(sta:0x30004) 07-19 18:47:03.154: I/amplayer(87): [player_thread_wait_exit:86]thead_id=149280 returning 07-19 18:47:03.154: I/amplayer(87): [player_exit]player thread already exit: 0 07-19 18:47:03.154: I/amplayer(87): [player_release_pid:72]release pid=23 07-19 18:47:03.154: I/amplayer(87): [player_exit:exit]pid=23 07-19 18:47:03.154: V/AmlogicPlayer(87): set fs/sys/class/video/disable_video=2 failed 07-19 18:47:03.154: I/amplayer(87): ENABLE_FREE_SCALE not define! 07-19 18:47:03.154: I/amplayer(87): [get_display_mode]display_mode=fail 07-19 18:47:03.154: I/amplayer(87): open /sys/class/graphics/fb0/scale fail. 07-19 18:47:03.154: I/amplayer(87): open /sys/class/graphics/fb1/scale fail. 07-19 18:47:03.154: I/amplayer(87): open /sys/class/graphics/fb1/scale_axis fail. 07-19 18:47:03.154: I/amplayer(87): open /sys/class/graphics/fb0/blank fail. 07-19 18:47:03.154: I/amplayer(87): open /sys/class/graphics/fb1/blank fail. 07-19 18:47:03.154: I/amplayer(87): [get_display_mode]display_mode=fail 07-19 18:47:03.154: I/amplayer(87): open /sys/class/graphics/fb0/free_scale fail. 07-19 18:47:03.154: I/amplayer(87): open /sys/class/graphics/fb1/free_scale fail. 07-19 18:47:03.154: I/amplayer(87): open /sys/class/video/axis fail. 07-19 18:47:03.154: I/amplayer(87): open /sys/class/ppmgr/ppscaler fail. 07-19 18:47:03.154: I/amplayer(87): open /sys/class/ppmgr/ppscaler_rect fail. 07-19 18:47:03.154: I/amplayer(87): display mode: 292344 07-19 18:47:03.154: I/amplayer(87): [enable_freescale_MBX]set video axis: 0 0 0 0 07-19 18:47:03.154: V/AmlogicPlayer(87): VideoViewClose=-33554433 07-19 18:47:03.154: V/AmlogicPlayer(87): [release::1471] 07-19 18:47:03.154: V/AmlogicPlayer(87): History mgt old[,0,-1] 07-19 18:47:03.154: V/AmlogicPlayer(87): History mgt [/mnt/sdcard/Android/data/au.com.nian.bullertv/files/tmpbtag.mp4,1,0] 07-19 18:47:03.154: V/AmSuperPlayer(87): createPlayer 07-19 18:47:03.154: V/AmSuperPlayer(87): create StagefrightPlayer 07-19 18:47:03.154: V/AmSuperPlayer(87): [CreatePlayer::678] 07-19 18:47:03.154: I/AwesomePlayer(87): setDataSource_l('/mnt/sdcard/Android/data/au.com.nian.bullertv/files/tmpbtag.mp4') 07-19 18:47:03.154: V/AmSuperPlayer(87): [CreatePlayer::713] 07-19 18:47:03.154: V/AmSuperPlayer(87): [CreatePlayer::729] 07-19 18:47:03.154: V/AmSuperPlayer(87): Start new player now=3 07-19 18:47:03.154: V/AmSuperPlayer(87): [initThread::762] 07-19 18:47:03.154: V/AmSuperPlayer(87): [notify::404] 07-19 18:47:03.154: V/AmSuperPlayer(87): [Notify::411] 07-19 18:47:03.154: V/AmSuperPlayer(87): cookie=0x475e0,msg=64,ext1=1,ext2=80000000 07-19 18:47:03.154: V/MediaPlayerService(87): [56] notify (0x23d50, 100, 1, -2147483648) 07-19 18:47:03.154: **E/MediaPlayer(7232): error (1, -2147483648)** 07-19 18:47:03.154: V/videoerr(7232): java.io.IOException: Prepare failed.: status=0x1 

UPDATE 2: I tested the code on two other Android devices (one ICS, one Gingerbread) and it is annoying that it works fine on them and works for more than 12 hours without incident. Thus, it looks like a platform error, but you still need to solve this problem.

+6
source share
3 answers

I am pretty sure that this is a problem with the Amlogic device being used (obviously due to the "amplayer" and "AmlogicPlayer" in logcat). We had a lot of problems with the Amlogic AML8726 device we are testing. If possible, try updating the firmware.

+1
source

I'm not sure. But I think this is due to some caching problem, as it plays for x times and then stops playing. The file is unavailable, which can be caused by several reasons: permissions, damaged file, wrong file, but this seems to be a different case.

Can you use reset and try again

public void reset () C: API Level 1

Resets MediaPlayer to an uninitialized state. After this method, you will have to initialize it again by setting the data source and calling prepare ().

0
source

Well, I never allowed it for my ultimate satisfaction, especially since it was especially for the device. In the end, I just added to the exception handling so that it doesn't crash when the video fails to play and just skip it and try again the next time.

The next time the video plays in a loop, so I guess this is something special for the device.

0
source

Source: https://habr.com/ru/post/920863/


All Articles