I'm trying to allow a YouTube video within a WebView to display at fullscreen. The problem is, a second or so after the video shows, the app crashes with a BadTokenException.
I'm using the code pretty much line for line from here: Android WebView with an embedded youtube video, full screen button freezes video
The only thing I changed was to let it match my activity and my view. It runs fine (without showing the video) if I comment out the line that sets the content view.
I've also tried the code from here: http://shashikawlp.wordpress.com/2013/06/25/play-html5-video-on-android-webview/
But I get the same issue.
Here's the stack from the debugger:
ViewRootImpl.setView(View, WindowManager$LayoutParams, View) line: 661
WindowManagerImpl.addView(View, ViewGroup$LayoutParams, CompatibilityInfoHolder, boolean) line: 326
WindowManagerImpl.addView(View, ViewGroup$LayoutParams, CompatibilityInfoHolder) line: 224
WindowManagerImpl$CompatModeWrapper.addView(View, ViewGroup$LayoutParams) line: 149
HTML5VideoFullScreen$FullScreenMediaController(MediaController).show(int) line: 338
HTML5VideoFullScreen$FullScreenMediaController(MediaController).show() line: 298
HTML5VideoFullScreen$FullScreenMediaController.show() line: 374
HTML5VideoFullScreen.onPrepared(MediaPlayer) line: 220
MediaPlayer$EventHandler.handleMessage(Message) line: 2071
MediaPlayer$EventHandler(Handler).dispatchMessage(Message) line: 99
Any ideas why the FullScreenMediaController isn't getting a proper window context to create itself on, which appears to be the root of the problem?