flutter_vlc_player
flutter_vlc_player copied to clipboard
Unexpected RTSP behavior when putting app in background
I have an application that displays an RTSP stream and it works as expected. However, if I switch to other app or put the application in the background, I get an unexpected behavior. The stream is replaced by the placeholder widget and never gets connected again. At first I thought it might be a problem from the server, but on further inspection the server has remained stable. I get the following on the console:
D/ViewRootImpl@1f0bd7d[MainActivity](18176): MSG_RESIZED: frame=Rect(0, 0 - 2220, 1080) ci=Rect(0, 72 - 45, 0) vi=Rect(0, 72 - 45, 0) or=2
D/SurfaceView(18176): onWindowVisibilityChanged(8) false io.flutter.embedding.android.FlutterSurfaceView{6a88f7a V.E...... ......I. 0,0-2175,1080} of ViewRootImpl@1f0bd7d[MainActivity]
D/SurfaceView(18176): show() Surface(name=SurfaceView - test.rtsp_test/test.rtsp_test.MainActivity@6a88f7a@15[18176])/@0x6379d4e io.flutter.embedding.android.FlutterSurfaceView{6a88f7a V.E...... ......I. 0,0-2175,1080}
D/SurfaceView(18176): surfaceDestroyed callback.size 1 #2 io.flutter.embedding.android.FlutterSurfaceView{6a88f7a V.E...... ......I. 0,0-2175,1080}
W/libEGL (18176): EGLNativeWindowType 0x7d86378010 disconnect failed
D/SurfaceView(18176): destroy() Surface(name=SurfaceView - test.rtsp_test/test.rtsp_test.MainActivity@6a88f7a@15[18176])/@0x6379d4e io.flutter.embedding.android.FlutterSurfaceView{6a88f7a V.E...... ......I. 0,0-2175,1080}
W/libEGL (18176): EGLNativeWindowType 0x7d68465010 disconnect failed
D/OpenGLRenderer(18176): eglDestroySurface = 0x7d9b479900, 0x7d68465000
D/ViewRootImpl@1f0bd7d[MainActivity](18176): Relayout returned: old=[0,0][2220,1080] new=[0,0][2220,1080] result=0x5 surface={valid=false 0} changed=true
D/ViewRootImpl@1f0bd7d[MainActivity](18176): MSG_WINDOW_FOCUS_CHANGED 0 1
D/InputMethodManager(18176): prepareNavigationBarInfo() DecorView@9ab7e41[MainActivity]
D/InputMethodManager(18176): getNavigationBarColor() -855310
D/ViewRootImpl@1f0bd7d[MainActivity](18176): setWindowStopped(true) old=false
D/SurfaceView(18176): windowStopped(true) false io.flutter.embedding.android.FlutterSurfaceView{6a88f7a V.E...... ......I. 0,0-2175,1080} of ViewRootImpl@1f0bd7d[MainActivity]
D/ViewRootImpl@1f0bd7d[MainActivity](18176): Surface release. android.view.WindowManagerGlobal.setStoppedState:669 android.app.Activity.performStop:7650 android.app.ActivityThread.callActivityOnStop:4379 android.app.ActivityThread.performStopActivityInner:4357 android.app.ActivityThread.handleStopActivity:4432 android.app.servertransaction.StopActivityItem.execute:41 android.app.servertransaction.TransactionExecutor.executeLifecycleState:145 android.app.servertransaction.TransactionExecutor.execute:70
D/InputTransport(18176): Input channel destroyed: fd=114
I/Choreographer(18176): Skipped 53 frames! The application may be doing too much work on its main thread.
D/ViewRootImpl@1f0bd7d[MainActivity](18176): Relayout returned: old=[0,0][2220,1080] new=[0,0][1080,2220] result=0x1 surface={valid=false 0} changed=false
I/OpenGLRenderer(18176): Davey! duration=1040ms; Flags=1, IntendedVsync=362323517850308, Vsync=362324401183606, OldestInputEvent=9223372036854775807, NewestInputEvent=0, HandleInputStart=362324403222267, AnimationStart=362324403311344, PerformTraversalsStart=362324403498498, DrawStart=362324548508690, SyncQueued=362324548639344, SyncStart=362324550126344, IssueDrawCommandsStart=362324550240305, SwapBuffers=362324556696113, FrameCompleted=362324559549844, DequeueBufferDuration=4182000, QueueBufferDuration=698000,
E/flutter (18176): [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: PlatformException(NullPointerException, java.lang.NullPointerException: Attempt to invoke virtual method 'void org.videolan.libvlc.MediaPlayer.pause()' on a null object reference, null, null)
E/flutter (18176): #0 VlcPlayerApi.pause
E/flutter (18176): <asynchronous suspension>
E/flutter (18176): #1 MethodChannelVlcPlayer.pause
E/flutter (18176): <asynchronous suspension>
E/flutter (18176): #2 VlcPlayerController.pause
E/flutter (18176): <asynchronous suspension>
E/flutter (18176):
I/MediaCodec(18176): setCodecState state : 0
D/SurfaceView(18176): onWindowVisibilityChanged(4) false io.flutter.embedding.android.FlutterSurfaceView{6a88f7a V.E...... ......I. 0,0-2175,1080} of ViewRootImpl@1f0bd7d[MainActivity]
D/ViewRootImpl@1f0bd7d[MainActivity](18176): Relayout returned: old=[0,0][1080,2220] new=[0,0][2220,1080] result=0x1 surface={valid=false 0} changed=false
D/ViewRootImpl@1f0bd7d[MainActivity](18176): setWindowStopped(false) old=true
D/SurfaceView(18176): windowStopped(false) false io.flutter.embedding.android.FlutterSurfaceView{6a88f7a V.E...... ......I. 0,0-2175,1080} of ViewRootImpl@1f0bd7d[MainActivity]
D/ViewRootImpl@1f0bd7d[MainActivity](18176): setWindowStopped(false) old=false
D/SurfaceView(18176): onWindowVisibilityChanged(0) true io.flutter.embedding.android.FlutterSurfaceView{6a88f7a V.E...... ......I. 0,0-2175,1080} of ViewRootImpl@1f0bd7d[MainActivity]
D/ViewRootImpl@1f0bd7d[MainActivity](18176): Relayout returned: old=[0,0][2220,1080] new=[0,0][2220,1080] result=0x7 surface={valid=true 538620350464} changed=true
D/mali_winsys(18176): EGLint new_window_surface(egl_winsys_display *, void *, EGLSurface, EGLConfig, egl_winsys_surface **, EGLBoolean) returns 0x3000
D/OpenGLRenderer(18176): eglCreateWindowSurface = 0x7d85b72900, 0x7d68465010
D/SurfaceView(18176): show() Surface(name=SurfaceView - test.rtsp_test/test.rtsp_test.MainActivity@6a88f7a@16[18176])/@0x2f1a805 io.flutter.embedding.android.FlutterSurfaceView{6a88f7a V.E...... ......I. 0,0-2175,1080}
D/SurfaceView(18176): surfaceCreated 1 #8 io.flutter.embedding.android.FlutterSurfaceView{6a88f7a V.E...... ......I. 0,0-2175,1080}
D/mali_winsys(18176): EGLint new_window_surface(egl_winsys_display *, void *, EGLSurface, EGLConfig, egl_winsys_surface **, EGLBoolean) returns 0x3000
D/SurfaceView(18176): surfaceChanged (2175,1080) 1 #8 io.flutter.embedding.android.FlutterSurfaceView{6a88f7a V.E...... ......I. 0,0-2175,1080}
D/ViewRootImpl@1f0bd7d[MainActivity](18176): MSG_RESIZED_REPORT: frame=Rect(0, 0 - 2220, 1080) ci=Rect(0, 72 - 45, 0) vi=Rect(0, 72 - 45, 0) or=2
D/ViewRootImpl@1f0bd7d[MainActivity](18176): MSG_WINDOW_FOCUS_CHANGED 1 1
D/InputMethodManager(18176): prepareNavigationBarInfo() DecorView@9ab7e41[MainActivity]
D/InputMethodManager(18176): getNavigationBarColor() -855310
D/InputMethodManager(18176): prepareNavigationBarInfo() DecorView@9ab7e41[MainActivity]
D/InputMethodManager(18176): getNavigationBarColor() -855310
V/InputMethodManager(18176): Starting input: tba=test.rtsp_test ic=null mNaviBarColor -855310 mIsGetNaviBarColorSuccess true , NavVisible : true , NavTrans : false
D/InputMethodManager(18176): startInputInner - Id : 0
I/InputMethodManager(18176): startInputInner - mService.startInputOrWindowGainedFocus
D/InputTransport(18176): Input channel constructed: fd=114
D/ViewRootImpl@1f0bd7d[MainActivity](18176): Relayout returned: old=[0,0][2220,1080] new=[0,0][2220,1080] result=0x3 surface={valid=true 538620350464} changed=false
W/libEGL (18176): EGLNativeWindowType 0x7d68465010 disconnect failed
D/OpenGLRenderer(18176): eglDestroySurface = 0x7d85b72900, 0x7d68465000
D/mali_winsys(18176): EGLint new_window_surface(egl_winsys_display *, void *, EGLSurface, EGLConfig, egl_winsys_surface **, EGLBoolean) returns 0x3000
D/OpenGLRenderer(18176): eglCreateWindowSurface = 0x7d85b72900, 0x7d68465010
D/ViewRootImpl@1f0bd7d[MainActivity](18176): MSG_RESIZED_REPORT: frame=Rect(0, 0 - 2220, 1080) ci=Rect(0, 72 - 45, 0) vi=Rect(0, 0 - 45, 0) or=2
I/MediaCodec(18176): setCodecState state : 1
E/VLC (18176): [0000007d7d814a90/62c1] libvlc decoder: Timestamp conversion failed (delay 1500000, buffering 0, bound 9000000)
E/VLC (18176): [0000007d7d814a90/62c1] libvlc decoder: Could not convert timestamp 362367371602 for mediacodec
E/VLC (18176): [0000007d7d814a90/62c1] libvlc decoder: Timestamp conversion failed (delay 1500000, buffering 0, bound 9000000)
E/VLC (18176): [0000007d7d814a90/62c1] libvlc decoder: Could not convert timestamp 362367404957 for mediacodec
E/VLC (18176): [0000007d7d814a90/62c1] libvlc decoder: Timestamp conversion failed (delay 1500000, buffering 0, bound 9000000)
E/VLC (18176): [0000007d7d814a90/62c1] libvlc decoder: Could not convert timestamp 362367438323 for mediacodec
E/VLC (18176): [0000007d7d814a90/62c1] libvlc decoder: Timestamp conversion failed (delay 1500000, buffering 0, bound 9000000)
E/VLC (18176): [0000007d7d814a90/62c1] libvlc decoder: Could not convert timestamp 362364527726 for mediacodec
E/VLC (18176): [0000007d7d814a90/62c1] libvlc decoder: Timestamp conversion failed (delay 1500000, buffering 0, bound 9000000)
E/VLC (18176): [0000007d7d814a90/62c1] libvlc decoder: Could not convert timestamp 362364561081 for mediacodec
E/VLC (18176): [0000007d7d814a90/62c1] libvlc decoder: Timestamp conversion failed (delay 1500000, buffering 0, bound 9000000)
E/VLC (18176): [0000007d7d814a90/62c1] libvlc decoder: Could not convert timestamp 362364594436 for mediacodec
E/VLC (18176): [0000007d7d814a90/62c1] libvlc decoder: Timestamp conversion failed (delay 1500000, buffering 0, bound 9000000)
E/VLC (18176): [0000007d7d814a90/62c1] libvlc decoder: Could not convert timestamp 362364627791 for mediacodec
E/VLC (18176): [0000007d7d814a90/62c1] libvlc decoder: Timestamp conversion failed (delay 1500000, buffering 0, bound 9000000)
E/VLC (18176): [0000007d7d814a90/62c1] libvlc decoder: Could not convert timestamp 362364661157 for mediacodec
E/VLC (18176): [0000007d7d814a90/62c1] libvlc decoder: Timestamp conversion failed (delay 1500000, buffering 0, bound 9000000)
E/VLC (18176): [0000007d7d814a90/62c1] libvlc decoder: Could not convert timestamp 362364694501 for mediacodec
E/VLC (18176): [0000007d7d814a90/62c1] libvlc decoder: Timestamp conversion failed (delay 1500000, buffering 0, bound 9000000)
E/VLC (18176): [0000007d7d814a90/62c1] libvlc decoder: Could not convert timestamp 362364727867 for mediacodec
E/VLC (18176): [0000007d7d814a90/62c1] libvlc decoder: Timestamp conversion failed (delay 1500000, buffering 0, bound 9000000)
E/VLC (18176): [0000007d7d814a90/62c1] libvlc decoder: Could not convert timestamp 362364761222 for mediacodec
E/VLC (18176): [0000007d7d814a90/62c1] libvlc decoder: Timestamp conversion failed (delay 1500000, buffering 0, bound 9000000)
E/VLC (18176): [0000007d7d814a90/62c1] libvlc decoder: Could not convert timestamp 362364794588 for mediacodec
E/VLC (18176): [0000007d7d814a90/62c1] libvlc decoder: Timestamp conversion failed (delay 1500000, buffering 0, bound 9000000)
E/VLC (18176): [0000007d7d814a90/62c1] libvlc decoder: Could not convert timestamp 362364827932 for mediacodec
E/VLC (18176): [0000007d7d814a90/62c1] libvlc decoder: Timestamp conversion failed (delay 1500000, buffering 0, bound 9000000)
E/VLC (18176): [0000007d7d814a90/62c1] libvlc decoder: Could not convert timestamp 362364861287 for mediacodec
E/VLC (18176): [0000007d7d814a90/62c1] libvlc decoder: Timestamp conversion failed (delay 1500000, buffering 0, bound 9000000)
E/VLC (18176): [0000007d7d814a90/62c1] libvlc decoder: Could not convert timestamp 362364894653 for mediacodec
E/VLC (18176): [0000007d7d814a90/62c1] libvlc decoder: Timestamp conversion failed (delay 1500000, buffering 0, bound 9000000)
E/VLC (18176): [0000007d7d814a90/62c1] libvlc decoder: Could not convert timestamp 362364928008 for mediacodec
E/VLC (18176): [0000007d7d814a90/62c1] libvlc decoder: Timestamp conversion failed (delay 1500000, buffering 0, bound 9000000)
E/VLC (18176): [0000007d7d814a90/62c1] libvlc decoder: Could not convert timestamp 362364961363 for mediacodec
E/VLC (18176): [0000007d7d814a90/62c1] libvlc decoder: Timestamp conversion failed (delay 1500000, buffering 0, bound 9000000)
E/VLC (18176): [0000007d7d814a90/62c1] libvlc decoder: Could not convert timestamp 362364994729 for mediacodec
E/VLC (18176): [0000007d7d814a90/62c1] libvlc decoder: Timestamp conversion failed (delay 1500000, buffering 0, bound 9000000)
E/VLC (18176): [0000007d7d814a90/62c1] libvlc decoder: Could not convert timestamp 362362706225 for mediacodec
E/VLC (18176): [0000007d7d814a90/62c1] libvlc decoder: Timestamp conversion failed (delay 1500000, buffering 0, bound 9000000)
E/VLC (18176): [0000007d7d814a90/62c1] libvlc decoder: Could not convert timestamp 362362739580 for mediacodec
E/VLC (18176): [0000007d7d814a90/62c1] libvlc decoder: Timestamp conversion failed (delay 1500000, buffering 0, bound 9000000)
E/VLC (18176): [0000007d7d814a90/62c1] libvlc decoder: Could not convert timestamp 362362772935 for mediacodec
E/VLC (18176): [0000007d7d814a90/62c1] libvlc decoder: Timestamp conversion failed (delay 1500000, buffering 0, bound 9000000)
E/VLC (18176): [0000007d7d814a90/62c1] libvlc decoder: Could not convert timestamp 362362772935 for mediacodec
E/VLC (18176): [0000007d7d814a90/62c1] libvlc decoder: Timestamp conversion failed (delay 1500000, buffering 0, bound 9000000)
E/VLC (18176): [0000007d7d814a90/62c1] libvlc decoder: Could not convert timestamp 362362806290 for mediacodec
E/VLC (18176): [0000007d7d814a90/62c1] libvlc decoder: Timestamp conversion failed (delay 1500000, buffering 0, bound 9000000)
E/VLC (18176): [0000007d7d814a90/62c1] libvlc decoder: Could not convert timestamp 362362839645 for mediacodec
E/VLC (18176): [0000007d7d814a90/62c1] libvlc decoder: Timestamp conversion failed (delay 1500000, buffering 0, bound 9000000)
E/VLC (18176): [0000007d7d814a90/62c1] libvlc decoder: Could not convert timestamp 362362873000 for mediacodec
E/VLC (18176): [0000007d7d814a90/62c1] libvlc decoder: Timestamp conversion failed (delay 1500000, buffering 0, bound 9000000)
E/VLC (18176): [0000007d7d814a90/62c1] libvlc decoder: Could not convert timestamp 362362906366 for mediacodec
I/MediaCodec(18176): setCodecState state : 0
I/MediaCodec(18176): setCodecState state : 1
I/MediaCodec(18176): setCodecState state : 0
I/MediaCodec(18176): setCodecState state : 1
I/MediaCodec(18176): setCodecState state : 0
I/MediaCodec(18176): setCodecState state : 1
I/MediaCodec(18176): setCodecState state : 0
I/MediaCodec(18176): setCodecState state : 1