Open EatHeat opened 10 years ago
You may try by using RelativeLayout to wrap your VideoView.
Hi @EatHeat !
How you have added VideoVideo? When i add a VideoVideo and set URL in the code. The app crashes:
05-25 15:00:06.475: E/AndroidRuntime(2870): FATAL EXCEPTION: main 05-25 15:00:06.475: E/AndroidRuntime(2870): Process: wei.mark.example, PID: 2870 05-25 15:00:06.475: E/AndroidRuntime(2870): android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an application 05-25 15:00:06.475: E/AndroidRuntime(2870): at android.view.ViewRootImpl.setView(ViewRootImpl.java:536) 05-25 15:00:06.475: E/AndroidRuntime(2870): at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:259) 05-25 15:00:06.475: E/AndroidRuntime(2870): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:69) 05-25 15:00:06.475: E/AndroidRuntime(2870): at android.app.Dialog.show(Dialog.java:286) 05-25 15:00:06.475: E/AndroidRuntime(2870): at android.app.AlertDialog$Builder.show(AlertDialog.java:951) 05-25 15:00:06.475: E/AndroidRuntime(2870): at android.widget.VideoView$5.onError(VideoView.java:515) 05-25 15:00:06.475: E/AndroidRuntime(2870): at android.widget.VideoView.openVideo(VideoView.java:354) 05-25 15:00:06.475: E/AndroidRuntime(2870): at android.widget.VideoView.access$2100(VideoView.java:71) 05-25 15:00:06.475: E/AndroidRuntime(2870): at android.widget.VideoView$7.surfaceCreated(VideoView.java:607) 05-25 15:00:06.475: E/AndroidRuntime(2870): at android.view.SurfaceView.updateWindow(SurfaceView.java:572) 05-25 15:00:06.475: E/AndroidRuntime(2870): at android.view.SurfaceView.access$000(SurfaceView.java:86) 05-25 15:00:06.475: E/AndroidRuntime(2870): at android.view.SurfaceView$3.onPreDraw(SurfaceView.java:175) 05-25 15:00:06.475: E/AndroidRuntime(2870): at android.view.ViewTreeObserver.dispatchOnPreDraw(ViewTreeObserver.java:847) 05-25 15:00:06.475: E/AndroidRuntime(2870): at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1867) 05-25 15:00:06.475: E/AndroidRuntime(2870): at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:996) 05-25 15:00:06.475: E/AndroidRuntime(2870): at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5600) 05-25 15:00:06.475: E/AndroidRuntime(2870): at android.view.Choreographer$CallbackRecord.run(Choreographer.java:761) 05-25 15:00:06.475: E/AndroidRuntime(2870): at android.view.Choreographer.doCallbacks(Choreographer.java:574) 05-25 15:00:06.475: E/AndroidRuntime(2870): at android.view.Choreographer.doFrame(Choreographer.java:544) 05-25 15:00:06.475: E/AndroidRuntime(2870): at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:747) 05-25 15:00:06.475: E/AndroidRuntime(2870): at android.os.Handler.handleCallback(Handler.java:733) 05-25 15:00:06.475: E/AndroidRuntime(2870): at android.os.Handler.dispatchMessage(Handler.java:95) 05-25 15:00:06.475: E/AndroidRuntime(2870): at android.os.Looper.loop(Looper.java:136) 05-25 15:00:06.475: E/AndroidRuntime(2870): at android.app.ActivityThread.main(ActivityThread.java:5001) 05-25 15:00:06.475: E/AndroidRuntime(2870): at java.lang.reflect.Method.invokeNative(Native Method) 05-25 15:00:06.475: E/AndroidRuntime(2870): at java.lang.reflect.Method.invoke(Method.java:515) 05-25 15:00:06.475: E/AndroidRuntime(2870): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785) 05-25 15:00:06.475: E/AndroidRuntime(2870): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601) 05-25 15:00:06.475: E/AndroidRuntime(2870): at dalvik.system.NativeStart.main(Native Method)
Thanks.
Add a handler and pass the url about 500 ms after you show the window.
Hi Mark,
I'm using StandOut in my new project and there seems to be a issue with VideoView. I asked a question on SO but didn't get any reply, so thought about pointing out to you. Here's the question- https://stackoverflow.com/questions/23699397/videoview-in-windowmanager-not-updating
As you can see in the images, the VideoView does not update on changing the window size. I have used SurfaceView and it works fine after changing the window params. But when changing the params in a window with VideoView, it does not take up the new size but keeps the old one. This happens with both expanding and reducing the window size.
Also, there's a problem with the seekbar as pointed out in the question though I'm not sure if its an issue with StandOut or something wrong with my code.
Can you suggest any workaround or fix for updating the VideoView size?