胖蔡说技术
随便扯扯

VideoView循环播放视频过程会出现自动退出播放现象

故障现象

视频播放过程会出现自动退出播放现象

检测

log检测,打印信息如下

E/MediaPlayer( 6773): error (1, -1)
E/MediaPlayer( 6773): Unable to create media player
W/VideoView( 6773): Unable to open content: file:///storage/external_storage/sdcard1/YXT_VID_20150811.mp4
W/VideoView( 6773): java.io.IOException: setDataSourceFD failed.: status=0x80000000
W/VideoView( 6773): at android.media.MediaPlayer._setDataSource(Native Method)
W/VideoView( 6773): at android.media.MediaPlayer.setDataSource(MediaPlayer.java:1118)
W/VideoView( 6773): at android.media.MediaPlayer.setDataSource(MediaPlayer.java:1102)
W/VideoView( 6773): at android.media.MediaPlayer.setDataSource(MediaPlayer.java:1081)
W/VideoView( 6773): at android.media.MediaPlayer.setDataSource(MediaPlayer.java:1035)
W/VideoView( 6773): at android.media.MediaPlayer.setDataSource(MediaPlayer.java:952)
W/VideoView( 6773): at android.widget.VideoView.openVideo(VideoView.java:335)
W/VideoView( 6773): at android.widget.VideoView.setVideoURI(VideoView.java:247)
W/VideoView( 6773): at android.widget.VideoView.setVideoURI(VideoView.java:237)
W/VideoView( 6773): at com.cai.test.MainActivity.onCompletion(MainActivity.java:77)
W/VideoView( 6773): at android.widget.VideoView$3.onCompletion(VideoView.java:472)
W/VideoView( 6773): at android.media.MediaPlayer$EventHandler.handleMessage(MediaPlayer.java:3479)
W/VideoView( 6773): at android.os.Handler.dispatchMessage(Handler.java:102)
W/VideoView( 6773): at android.os.Looper.loop(Looper.java:136)
W/VideoView( 6773): at android.app.ActivityThread.main(ActivityThread.java:5017)
W/VideoView( 6773): at java.lang.reflect.Method.invokeNative(Native Method)
W/VideoView( 6773): at java.lang.reflect.Method.invoke(Method.java:515)
W/VideoView( 6773): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:788)
W/VideoView( 6773): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:604)
W/VideoView( 6773): at dalvik.system.NativeStart.main(Native Method)
D/VideoView( 6773): Error: 1,0
E/MediaPlayer( 6773): pause called in state 0
E/MediaPlayer( 6773): stop called in state 0
D/dalvikvm( 6773): GC_CONCURRENT freed 337K, 44% free 1988K/3508K, paused 1ms+1ms, total 10ms
D/dalvikvm( 6773): GC_FOR_ALLOC freed 58K, 45% free 1929K/3508K, paused 7ms, total 7ms
I/dalvikvm-heap( 6773): Grow heap (frag case) to 2.514MB for 635812-byte allocation
D/dalvikvm( 6773): GC_FOR_ALLOC freed <1K, 28% free 2550K/3508K, paused 10ms, total 10ms
D/dalvikvm( 6773): GC_CONCURRENT freed 1K, 23% free 2712K/3508K, paused 1ms+2ms, total 11ms
E/MediaPlayer( 6773): enter record_logfile :   
E/MediaPlayer( 6773): =====>line 3274
I/MediaPlayer( 6773): =====>line 3286
I/MediaPlayer( 6773): str_log #systemtime:19860731032344
I/MediaPlayer( 6773): url:null
I/MediaPlayer( 6773): playtime:1676555
I/MediaPlayer( 6773): status:100
I/MediaPlayer( 6773): desc:Unknow errorPlayer error
I/MediaPlayer( 6773): 
E/MediaPlayer( 6773): log_buf.length 202
W/System.err( 6773): java.io.FileNotFoundException: /tmp/playLog/19860731031513.txt: open failed: ENOENT (No such file or directory)
W/System.err( 6773): at libcore.io.IoBridge.open(IoBridge.java:409)
W/System.err( 6773): at java.io.FileOutputStream.<init>(FileOutputStream.java:88)
W/System.err( 6773): at android.media.MediaPlayer$EventHandler.record_logfile(MediaPlayer.java:3332)
W/System.err( 6773): at android.media.MediaPlayer$EventHandler.handleMessage(MediaPlayer.java:3462)
W/System.err( 6773): at android.os.Handler.dispatchMessage(Handler.java:102)
W/System.err( 6773): at android.os.Looper.loop(Looper.java:136)
W/System.err( 6773): at android.app.ActivityThread.main(ActivityThread.java:5017)
W/System.err( 6773): at java.lang.reflect.Method.invokeNative(Native Method)
W/System.err( 6773): at java.lang.reflect.Method.invoke(Method.java:515)
W/System.err( 6773): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:788)
W/System.err( 6773): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:604)
W/System.err( 6773): at dalvik.system.NativeStart.main(Native Method)
W/System.err( 6773): Caused by: libcore.io.ErrnoException: open failed: ENOENT (No such file or directory)
W/System.err( 6773): at libcore.io.Posix.open(Native Method)
W/System.err( 6773): at libcore.io.BlockGuardOs.open(BlockGuardOs.java:110)
W/System.err( 6773): at libcore.io.IoBridge.open(IoBridge.java:393)
W/System.err( 6773): ... 11 more
E/MediaPlayer( 6773): msg :   { when=-198ms what=100 arg1=1 arg2=-1 target=android.media.MediaPlayer$EventHandler }
E/MediaPlayer( 6773): Error (1,-1)
D/VideoView( 6773): Error: 1,-1
E/MediaPlayer( 6773): pause called in state 0
E/MediaPlayer( 6773): stop called in state 0
I/VideoView( 6773): Layout changed,left=0 top=0 right=1920 bottom=800
I/VideoView( 6773): Layout changed,oldLeft=0 oldTop=0 oldRight=1920 oldBottom=800
I/VideoView( 6773): .left=0.top=0.right=1920.bottom=800.oldLeft=0.oldTop=0.oldRight=1920.oldBottom=800.Rotation=0
E/WindowManager( 6773): 
E/WindowManager( 6773): android.view.WindowLeaked: Activity com.cai.test.MainActivity has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView{417ecf10 V.E..... R.....I. 0,0-523,223} that was originally added here
E/WindowManager( 6773): at android.view.ViewRootImpl.<init>(ViewRootImpl.java:348)
E/WindowManager( 6773): at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:248)
E/WindowManager( 6773): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:69)
E/WindowManager( 6773): at android.app.Dialog.show(Dialog.java:286)
E/WindowManager( 6773): at android.app.AlertDialog$Builder.show(AlertDialog.java:951)
E/WindowManager( 6773): at android.widget.VideoView$5.onError(VideoView.java:519)
E/WindowManager( 6773): at android.widget.VideoView.openVideo(VideoView.java:358)
E/WindowManager( 6773): at android.widget.VideoView.setVideoURI(VideoView.java:247)
E/WindowManager( 6773): at android.widget.VideoView.setVideoURI(VideoView.java:237)
E/WindowManager( 6773): at com.cai.test.MainActivity.onCompletion(MainActivity.java:77)
E/WindowManager( 6773): at android.widget.VideoView$3.onCompletion(VideoView.java:472)
E/WindowManager( 6773): at android.media.MediaPlayer$EventHandler.handleMessage(MediaPlayer.java:3479)
E/WindowManager( 6773): at android.os.Handler.dispatchMessage(Handler.java:102)
E/WindowManager( 6773): at android.os.Looper.loop(Looper.java:136)
E/WindowManager( 6773): at android.app.ActivityThread.main(ActivityThread.java:5017)
E/WindowManager( 6773): at java.lang.reflect.Method.invokeNative(Native Method)
E/WindowManager( 6773): at java.lang.reflect.Method.invoke(Method.java:515)
E/WindowManager( 6773): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:788)
E/WindowManager( 6773): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:604)
E/WindowManager( 6773): at dalvik.system.NativeStart.main(Native Method)
E/WindowManager( 6773): 
E/WindowManager( 6773): android.view.WindowLeaked: Activity com.cai.test.MainActivity has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView{417f5790 V.E..... R.....I. 0,0-523,223} that was originally added here
E/WindowManager( 6773): at android.view.ViewRootImpl.<init>(ViewRootImpl.java:348)
E/WindowManager( 6773): at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:248)
E/WindowManager( 6773): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:69)
E/WindowManager( 6773): at android.app.Dialog.show(Dialog.java:286)
E/WindowManager( 6773): at android.app.AlertDialog$Builder.show(AlertDialog.java:951)
E/WindowManager( 6773): at android.widget.VideoView$5.onError(VideoView.java:519)
E/WindowManager( 6773): at android.media.MediaPlayer$EventHandler.handleMessage(MediaPlayer.java:3522)
E/WindowManager( 6773): at android.os.Handler.dispatchMessage(Handler.java:102)
E/WindowManager( 6773): at android.os.Looper.loop(Looper.java:136)
E/WindowManager( 6773): at android.app.ActivityThread.main(ActivityThread.java:5017)
E/WindowManager( 6773): at java.lang.reflect.Method.invokeNative(Native Method)
E/WindowManager( 6773): at java.lang.reflect.Method.invoke(Method.java:515)
E/WindowManager( 6773): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:788)
E/WindowManager( 6773): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:604)
E/WindowManager( 6773): at dalvik.system.NativeStart.main(Native Method)

分析原因

可能是视频源问题、路径问题 经测试换了视频源后视频连续播放50余小时未出现上述播放退出情况。

赞(0) 打赏
转载请附上原文出处链接:胖蔡叨叨叨 » VideoView循环播放视频过程会出现自动退出播放现象
分享到: 更多 (0)

请小编喝杯咖啡~

支付宝扫一扫打赏

微信扫一扫打赏