[android-developers] Re: How to properly implement dismissing HTML5 video from WebView
Hi, Brian and Mariusz I have the same problem: I have a WebView embedded in my app. The video plays find inline, but when I click fullscreen, it crashes the app. By reading all the posts, I still do not understand how you guys fix the problem. :( ds On Tuesday, May 22, 2012 4:59:04 PM UTC-4, Brian wrote: I am having the following problem. The following problems only apply on Ice Cream Sandwich (probably also happen on honeycomb) but do not happen on gingerbread or froyo. If i implement onShowCustomView() method of a WebChromeClient to show fullscreen video for an embedded video in a WebView. I don't know how to override the back button properly to dismiss the video. If i dont override the back button, then presses the back button closes the whole activity. If i listen for the back button events, on the focused child of the custom view, than I can dismiss the video but, I have no way of detecting if the MediaController is showing, in which case I would prefer not to dismiss the video. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: How to properly implement dismissing HTML5 video from WebView
Hi, You need to create your own class extending WebChromeClient and override onShowCustomView method. Your webview should use your webchromeclient. Regards, Mariusz On Tuesday, June 12, 2012 9:25:06 PM UTC+2, dongsheng wrote: Hi, Brian and Mariusz I have the same problem: I have a WebView embedded in my app. The video plays find inline, but when I click fullscreen, it crashes the app. By reading all the posts, I still do not understand how you guys fix the problem. :( ds On Tuesday, May 22, 2012 4:59:04 PM UTC-4, Brian wrote: I am having the following problem. The following problems only apply on Ice Cream Sandwich (probably also happen on honeycomb) but do not happen on gingerbread or froyo. If i implement onShowCustomView() method of a WebChromeClient to show fullscreen video for an embedded video in a WebView. I don't know how to override the back button properly to dismiss the video. If i dont override the back button, then presses the back button closes the whole activity. If i listen for the back button events, on the focused child of the custom view, than I can dismiss the video but, I have no way of detecting if the MediaController is showing, in which case I would prefer not to dismiss the video. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: How to properly implement dismissing HTML5 video from WebView
Hi Dongsheng, You may want to post some code, and the stacktrace and logcat console of the crash your experiencing. --Brian -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: How to properly implement dismissing HTML5 video from WebView
Thanks Brian! I'll need to pass it to MediaPlayer to take control! Regards, Mariusz On Sunday, May 27, 2012 5:00:13 PM UTC+2, Brian wrote: Hello Mariusz, Sorry about the slowness of my reply. In any case, getFocusedChild() will return a VideoView object in froyo, and gingerbread. But in Honeycomb and above it returns some inner class of HTML5VideoFullScreen. As a result much of the example code out there for playing video's embedded in webview's does not work on honeycomb and gingerbread. --Brian On Wednesday, May 23, 2012 4:43:53 PM UTC-4, Mariusz wrote: Brian, I have exactly the same - getFocusedChild() method returns a HTML5VideoFullScreen object, but I saw on several examples it should/could(?) return a VideoView object. Regards, Mariusz On Wednesday, May 23, 2012 1:34:39 AM UTC+2, Brian wrote: Mariusz, I almost can. If you call getFocusedChild() on the FrameLayout, it returns a HTML5VideoFullScreen$SurfaceViewHolder object, which is an inner class of HTML5VideoFullScreen. I am not sure if there is way to access the HTML5VideoFullScreen object from that SurfaceViewHolder. However at this point, all these classes are private APIs, and using them would likely be dangerous code, since these are not interfaces that applications are suppose to be able to access. On Tuesday, May 22, 2012 7:07:24 PM UTC-4, Mariusz wrote: Brian, I have one question - are you able somehow to get access to Video object on 'onShowCustomView(View, CustomViewCallback)' method? In my case view returns FrameLayout and callback returns HTML5VideoFullScreen object. Thanks, Mariusz On Wednesday, May 23, 2012 12:40:16 AM UTC+2, Brian wrote: Mariusz, Thank you. I was getting hung up by the fact that I was specifically using the key listener to listen for KEYCODE_BACK, using the onBackPressed() method seems to solve my issue. Thank you. On Tuesday, May 22, 2012 5:37:55 PM UTC-4, Mariusz wrote: Hi, I implemented back action in the following way (activity level): @Override public void onBackPressed() { if(mCustomView != null mWebChromeClient != null) { mWebChromeClient.onHideCustomView(); } } ... at MyWebChromeClient level: @Override public void onHideCustomView() { if (mCustomView == null) return; mCustomView.setVisibility(View.GONE); mCustomViewContainer.removeView(mCustomView); mCustomView = null; mCustomViewContainer.setVisibility(View.GONE); mCustomViewCallback.onCustomViewHidden(); setStatusBarVisibility(true); mContentView.setVisibility(View.VISIBLE); } Regards, Mariusz On Tuesday, May 22, 2012 11:31:38 PM UTC+2, Brian wrote: I think that I should probably add to my description.. what I would my goal is. My goal is for the HTML5 video to play in fullscreen mode, when the use presses the fullscreen button, but when the users presses the back button to dismiss the video, but still show the original webview. With the exception that i do not want to hide the video, if the MediaController is currently visible in front of the video, in that case only the MediaController should get hidden (which happens automatically) On Tuesday, May 22, 2012 11:31:38 PM UTC+2, Brian wrote: I think that I should probably add to my description.. what I would my goal is. My goal is for the HTML5 video to play in fullscreen mode, when the use presses the fullscreen button, but when the users presses the back button to dismiss the video, but still show the original webview. With the exception that i do not want to hide the video, if the MediaController is currently visible in front of the video, in that case only the MediaController should get hidden (which happens automatically) On Tuesday, May 22, 2012 11:31:38 PM UTC+2, Brian wrote: I think that I should probably add to my description.. what I would my goal is. My goal is for the HTML5 video to play in fullscreen mode, when the use presses the fullscreen button, but when the users presses the back button to dismiss the video, but still show the original webview. With the exception that i do not want to hide the video, if the MediaController is currently visible in front of the video, in that case only the MediaController should get hidden (which happens automatically) On Tuesday, May 22, 2012 5:37:55 PM UTC-4, Mariusz wrote: Hi, I implemented back action in the following way (activity level): @Override public void onBackPressed() { if(mCustomView != null mWebChromeClient != null) { mWebChromeClient.onHideCustomView(); } } ... at MyWebChromeClient level: @Override public void onHideCustomView() { if (mCustomView == null) return; mCustomView.setVisibility(View.GONE); mCustomViewContainer.removeView(mCustomView);
[android-developers] Re: How to properly implement dismissing HTML5 video from WebView
Hello Mariusz, Sorry about the slowness of my reply. In any case, getFocusedChild() will return a VideoView object in froyo, and gingerbread. But in Honeycomb and above it returns some inner class of HTML5VideoFullScreen. As a result much of the example code out there for playing video's embedded in webview's does not work on honeycomb and gingerbread. --Brian On Wednesday, May 23, 2012 4:43:53 PM UTC-4, Mariusz wrote: Brian, I have exactly the same - getFocusedChild() method returns a HTML5VideoFullScreen object, but I saw on several examples it should/could(?) return a VideoView object. Regards, Mariusz On Wednesday, May 23, 2012 1:34:39 AM UTC+2, Brian wrote: Mariusz, I almost can. If you call getFocusedChild() on the FrameLayout, it returns a HTML5VideoFullScreen$SurfaceViewHolder object, which is an inner class of HTML5VideoFullScreen. I am not sure if there is way to access the HTML5VideoFullScreen object from that SurfaceViewHolder. However at this point, all these classes are private APIs, and using them would likely be dangerous code, since these are not interfaces that applications are suppose to be able to access. On Tuesday, May 22, 2012 7:07:24 PM UTC-4, Mariusz wrote: Brian, I have one question - are you able somehow to get access to Video object on 'onShowCustomView(View, CustomViewCallback)' method? In my case view returns FrameLayout and callback returns HTML5VideoFullScreen object. Thanks, Mariusz On Wednesday, May 23, 2012 12:40:16 AM UTC+2, Brian wrote: Mariusz, Thank you. I was getting hung up by the fact that I was specifically using the key listener to listen for KEYCODE_BACK, using the onBackPressed() method seems to solve my issue. Thank you. On Tuesday, May 22, 2012 5:37:55 PM UTC-4, Mariusz wrote: Hi, I implemented back action in the following way (activity level): @Override public void onBackPressed() { if(mCustomView != null mWebChromeClient != null) { mWebChromeClient.onHideCustomView(); } } ... at MyWebChromeClient level: @Override public void onHideCustomView() { if (mCustomView == null) return; mCustomView.setVisibility(View.GONE); mCustomViewContainer.removeView(mCustomView); mCustomView = null; mCustomViewContainer.setVisibility(View.GONE); mCustomViewCallback.onCustomViewHidden(); setStatusBarVisibility(true); mContentView.setVisibility(View.VISIBLE); } Regards, Mariusz On Tuesday, May 22, 2012 11:31:38 PM UTC+2, Brian wrote: I think that I should probably add to my description.. what I would my goal is. My goal is for the HTML5 video to play in fullscreen mode, when the use presses the fullscreen button, but when the users presses the back button to dismiss the video, but still show the original webview. With the exception that i do not want to hide the video, if the MediaController is currently visible in front of the video, in that case only the MediaController should get hidden (which happens automatically) On Tuesday, May 22, 2012 11:31:38 PM UTC+2, Brian wrote: I think that I should probably add to my description.. what I would my goal is. My goal is for the HTML5 video to play in fullscreen mode, when the use presses the fullscreen button, but when the users presses the back button to dismiss the video, but still show the original webview. With the exception that i do not want to hide the video, if the MediaController is currently visible in front of the video, in that case only the MediaController should get hidden (which happens automatically) On Tuesday, May 22, 2012 11:31:38 PM UTC+2, Brian wrote: I think that I should probably add to my description.. what I would my goal is. My goal is for the HTML5 video to play in fullscreen mode, when the use presses the fullscreen button, but when the users presses the back button to dismiss the video, but still show the original webview. With the exception that i do not want to hide the video, if the MediaController is currently visible in front of the video, in that case only the MediaController should get hidden (which happens automatically) On Tuesday, May 22, 2012 5:37:55 PM UTC-4, Mariusz wrote: Hi, I implemented back action in the following way (activity level): @Override public void onBackPressed() { if(mCustomView != null mWebChromeClient != null) { mWebChromeClient.onHideCustomView(); } } ... at MyWebChromeClient level: @Override public void onHideCustomView() { if (mCustomView == null) return; mCustomView.setVisibility(View.GONE); mCustomViewContainer.removeView(mCustomView); mCustomView = null; mCustomViewContainer.setVisibility(View.GONE); mCustomViewCallback.onCustomViewHidden();
[android-developers] Re: How to properly implement dismissing HTML5 video from WebView
Brian, I have exactly the same - getFocusedChild() method returns a HTML5VideoFullScreen object, but I saw on several examples it should/could(?) return a VideoView object. Regards, Mariusz On Wednesday, May 23, 2012 1:34:39 AM UTC+2, Brian wrote: Mariusz, I almost can. If you call getFocusedChild() on the FrameLayout, it returns a HTML5VideoFullScreen$SurfaceViewHolder object, which is an inner class of HTML5VideoFullScreen. I am not sure if there is way to access the HTML5VideoFullScreen object from that SurfaceViewHolder. However at this point, all these classes are private APIs, and using them would likely be dangerous code, since these are not interfaces that applications are suppose to be able to access. On Tuesday, May 22, 2012 7:07:24 PM UTC-4, Mariusz wrote: Brian, I have one question - are you able somehow to get access to Video object on 'onShowCustomView(View, CustomViewCallback)' method? In my case view returns FrameLayout and callback returns HTML5VideoFullScreen object. Thanks, Mariusz On Wednesday, May 23, 2012 12:40:16 AM UTC+2, Brian wrote: Mariusz, Thank you. I was getting hung up by the fact that I was specifically using the key listener to listen for KEYCODE_BACK, using the onBackPressed() method seems to solve my issue. Thank you. On Tuesday, May 22, 2012 5:37:55 PM UTC-4, Mariusz wrote: Hi, I implemented back action in the following way (activity level): @Override public void onBackPressed() { if(mCustomView != null mWebChromeClient != null) { mWebChromeClient.onHideCustomView(); } } ... at MyWebChromeClient level: @Override public void onHideCustomView() { if (mCustomView == null) return; mCustomView.setVisibility(View.GONE); mCustomViewContainer.removeView(mCustomView); mCustomView = null; mCustomViewContainer.setVisibility(View.GONE); mCustomViewCallback.onCustomViewHidden(); setStatusBarVisibility(true); mContentView.setVisibility(View.VISIBLE); } Regards, Mariusz On Tuesday, May 22, 2012 11:31:38 PM UTC+2, Brian wrote: I think that I should probably add to my description.. what I would my goal is. My goal is for the HTML5 video to play in fullscreen mode, when the use presses the fullscreen button, but when the users presses the back button to dismiss the video, but still show the original webview. With the exception that i do not want to hide the video, if the MediaController is currently visible in front of the video, in that case only the MediaController should get hidden (which happens automatically) On Tuesday, May 22, 2012 11:31:38 PM UTC+2, Brian wrote: I think that I should probably add to my description.. what I would my goal is. My goal is for the HTML5 video to play in fullscreen mode, when the use presses the fullscreen button, but when the users presses the back button to dismiss the video, but still show the original webview. With the exception that i do not want to hide the video, if the MediaController is currently visible in front of the video, in that case only the MediaController should get hidden (which happens automatically) On Tuesday, May 22, 2012 11:31:38 PM UTC+2, Brian wrote: I think that I should probably add to my description.. what I would my goal is. My goal is for the HTML5 video to play in fullscreen mode, when the use presses the fullscreen button, but when the users presses the back button to dismiss the video, but still show the original webview. With the exception that i do not want to hide the video, if the MediaController is currently visible in front of the video, in that case only the MediaController should get hidden (which happens automatically) On Tuesday, May 22, 2012 5:37:55 PM UTC-4, Mariusz wrote: Hi, I implemented back action in the following way (activity level): @Override public void onBackPressed() { if(mCustomView != null mWebChromeClient != null) { mWebChromeClient.onHideCustomView(); } } ... at MyWebChromeClient level: @Override public void onHideCustomView() { if (mCustomView == null) return; mCustomView.setVisibility(View.GONE); mCustomViewContainer.removeView(mCustomView); mCustomView = null; mCustomViewContainer.setVisibility(View.GONE); mCustomViewCallback.onCustomViewHidden(); setStatusBarVisibility(true); mContentView.setVisibility(View.VISIBLE); } Regards, Mariusz On Tuesday, May 22, 2012 11:31:38 PM UTC+2, Brian wrote: I think that I should probably add to my description.. what I would my goal is. My goal is for the HTML5 video to play in fullscreen mode, when the use presses the fullscreen button, but when the users presses the back button to dismiss the video, but still show the original webview. With
[android-developers] Re: How to properly implement dismissing HTML5 video from WebView
I think that I should probably add to my description.. what I would my goal is. My goal is for the HTML5 video to play in fullscreen mode, when the use presses the fullscreen button, but when the users presses the back button to dismiss the video, but still show the original webview. With the exception that i do not want to hide the video, if the MediaController is currently visible in front of the video, in that case only the MediaController should get hidden (which happens automatically) -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: How to properly implement dismissing HTML5 video from WebView
Hi, I implemented back action in the following way (activity level): @Override public void onBackPressed() { if(mCustomView != null mWebChromeClient != null) { mWebChromeClient.onHideCustomView(); } } ... at MyWebChromeClient level: @Override public void onHideCustomView() { if (mCustomView == null) return; mCustomView.setVisibility(View.GONE); mCustomViewContainer.removeView(mCustomView); mCustomView = null; mCustomViewContainer.setVisibility(View.GONE); mCustomViewCallback.onCustomViewHidden(); setStatusBarVisibility(true); mContentView.setVisibility(View.VISIBLE); } Regards, Mariusz On Tuesday, May 22, 2012 11:31:38 PM UTC+2, Brian wrote: I think that I should probably add to my description.. what I would my goal is. My goal is for the HTML5 video to play in fullscreen mode, when the use presses the fullscreen button, but when the users presses the back button to dismiss the video, but still show the original webview. With the exception that i do not want to hide the video, if the MediaController is currently visible in front of the video, in that case only the MediaController should get hidden (which happens automatically) On Tuesday, May 22, 2012 11:31:38 PM UTC+2, Brian wrote: I think that I should probably add to my description.. what I would my goal is. My goal is for the HTML5 video to play in fullscreen mode, when the use presses the fullscreen button, but when the users presses the back button to dismiss the video, but still show the original webview. With the exception that i do not want to hide the video, if the MediaController is currently visible in front of the video, in that case only the MediaController should get hidden (which happens automatically) On Tuesday, May 22, 2012 11:31:38 PM UTC+2, Brian wrote: I think that I should probably add to my description.. what I would my goal is. My goal is for the HTML5 video to play in fullscreen mode, when the use presses the fullscreen button, but when the users presses the back button to dismiss the video, but still show the original webview. With the exception that i do not want to hide the video, if the MediaController is currently visible in front of the video, in that case only the MediaController should get hidden (which happens automatically) -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: How to properly implement dismissing HTML5 video from WebView
Mariusz, Thank you. I was getting hung up by the fact that I was specifically using the key listener to listen for KEYCODE_BACK, using the onBackPressed() method seems to solve my issue. Thank you. On Tuesday, May 22, 2012 5:37:55 PM UTC-4, Mariusz wrote: Hi, I implemented back action in the following way (activity level): @Override public void onBackPressed() { if(mCustomView != null mWebChromeClient != null) { mWebChromeClient.onHideCustomView(); } } ... at MyWebChromeClient level: @Override public void onHideCustomView() { if (mCustomView == null) return; mCustomView.setVisibility(View.GONE); mCustomViewContainer.removeView(mCustomView); mCustomView = null; mCustomViewContainer.setVisibility(View.GONE); mCustomViewCallback.onCustomViewHidden(); setStatusBarVisibility(true); mContentView.setVisibility(View.VISIBLE); } Regards, Mariusz On Tuesday, May 22, 2012 11:31:38 PM UTC+2, Brian wrote: I think that I should probably add to my description.. what I would my goal is. My goal is for the HTML5 video to play in fullscreen mode, when the use presses the fullscreen button, but when the users presses the back button to dismiss the video, but still show the original webview. With the exception that i do not want to hide the video, if the MediaController is currently visible in front of the video, in that case only the MediaController should get hidden (which happens automatically) On Tuesday, May 22, 2012 11:31:38 PM UTC+2, Brian wrote: I think that I should probably add to my description.. what I would my goal is. My goal is for the HTML5 video to play in fullscreen mode, when the use presses the fullscreen button, but when the users presses the back button to dismiss the video, but still show the original webview. With the exception that i do not want to hide the video, if the MediaController is currently visible in front of the video, in that case only the MediaController should get hidden (which happens automatically) On Tuesday, May 22, 2012 11:31:38 PM UTC+2, Brian wrote: I think that I should probably add to my description.. what I would my goal is. My goal is for the HTML5 video to play in fullscreen mode, when the use presses the fullscreen button, but when the users presses the back button to dismiss the video, but still show the original webview. With the exception that i do not want to hide the video, if the MediaController is currently visible in front of the video, in that case only the MediaController should get hidden (which happens automatically) On Tuesday, May 22, 2012 5:37:55 PM UTC-4, Mariusz wrote: Hi, I implemented back action in the following way (activity level): @Override public void onBackPressed() { if(mCustomView != null mWebChromeClient != null) { mWebChromeClient.onHideCustomView(); } } ... at MyWebChromeClient level: @Override public void onHideCustomView() { if (mCustomView == null) return; mCustomView.setVisibility(View.GONE); mCustomViewContainer.removeView(mCustomView); mCustomView = null; mCustomViewContainer.setVisibility(View.GONE); mCustomViewCallback.onCustomViewHidden(); setStatusBarVisibility(true); mContentView.setVisibility(View.VISIBLE); } Regards, Mariusz On Tuesday, May 22, 2012 11:31:38 PM UTC+2, Brian wrote: I think that I should probably add to my description.. what I would my goal is. My goal is for the HTML5 video to play in fullscreen mode, when the use presses the fullscreen button, but when the users presses the back button to dismiss the video, but still show the original webview. With the exception that i do not want to hide the video, if the MediaController is currently visible in front of the video, in that case only the MediaController should get hidden (which happens automatically) On Tuesday, May 22, 2012 11:31:38 PM UTC+2, Brian wrote: I think that I should probably add to my description.. what I would my goal is. My goal is for the HTML5 video to play in fullscreen mode, when the use presses the fullscreen button, but when the users presses the back button to dismiss the video, but still show the original webview. With the exception that i do not want to hide the video, if the MediaController is currently visible in front of the video, in that case only the MediaController should get hidden (which happens automatically) On Tuesday, May 22, 2012 11:31:38 PM UTC+2, Brian wrote: I think that I should probably add to my description.. what I would my goal is. My goal is for the HTML5 video to play in fullscreen mode, when the use presses the fullscreen button, but when the users presses the back button to dismiss the video, but still show the
[android-developers] Re: How to properly implement dismissing HTML5 video from WebView
Brian, I have one question - are you able somehow to get access to Video object on 'onShowCustomView(View, CustomViewCallback)' method? In my case view returns FrameLayout and callback returns HTML5VideoFullScreen object. Thanks, Mariusz On Wednesday, May 23, 2012 12:40:16 AM UTC+2, Brian wrote: Mariusz, Thank you. I was getting hung up by the fact that I was specifically using the key listener to listen for KEYCODE_BACK, using the onBackPressed() method seems to solve my issue. Thank you. On Tuesday, May 22, 2012 5:37:55 PM UTC-4, Mariusz wrote: Hi, I implemented back action in the following way (activity level): @Override public void onBackPressed() { if(mCustomView != null mWebChromeClient != null) { mWebChromeClient.onHideCustomView(); } } ... at MyWebChromeClient level: @Override public void onHideCustomView() { if (mCustomView == null) return; mCustomView.setVisibility(View.GONE); mCustomViewContainer.removeView(mCustomView); mCustomView = null; mCustomViewContainer.setVisibility(View.GONE); mCustomViewCallback.onCustomViewHidden(); setStatusBarVisibility(true); mContentView.setVisibility(View.VISIBLE); } Regards, Mariusz On Tuesday, May 22, 2012 11:31:38 PM UTC+2, Brian wrote: I think that I should probably add to my description.. what I would my goal is. My goal is for the HTML5 video to play in fullscreen mode, when the use presses the fullscreen button, but when the users presses the back button to dismiss the video, but still show the original webview. With the exception that i do not want to hide the video, if the MediaController is currently visible in front of the video, in that case only the MediaController should get hidden (which happens automatically) On Tuesday, May 22, 2012 11:31:38 PM UTC+2, Brian wrote: I think that I should probably add to my description.. what I would my goal is. My goal is for the HTML5 video to play in fullscreen mode, when the use presses the fullscreen button, but when the users presses the back button to dismiss the video, but still show the original webview. With the exception that i do not want to hide the video, if the MediaController is currently visible in front of the video, in that case only the MediaController should get hidden (which happens automatically) On Tuesday, May 22, 2012 11:31:38 PM UTC+2, Brian wrote: I think that I should probably add to my description.. what I would my goal is. My goal is for the HTML5 video to play in fullscreen mode, when the use presses the fullscreen button, but when the users presses the back button to dismiss the video, but still show the original webview. With the exception that i do not want to hide the video, if the MediaController is currently visible in front of the video, in that case only the MediaController should get hidden (which happens automatically) On Tuesday, May 22, 2012 5:37:55 PM UTC-4, Mariusz wrote: Hi, I implemented back action in the following way (activity level): @Override public void onBackPressed() { if(mCustomView != null mWebChromeClient != null) { mWebChromeClient.onHideCustomView(); } } ... at MyWebChromeClient level: @Override public void onHideCustomView() { if (mCustomView == null) return; mCustomView.setVisibility(View.GONE); mCustomViewContainer.removeView(mCustomView); mCustomView = null; mCustomViewContainer.setVisibility(View.GONE); mCustomViewCallback.onCustomViewHidden(); setStatusBarVisibility(true); mContentView.setVisibility(View.VISIBLE); } Regards, Mariusz On Tuesday, May 22, 2012 11:31:38 PM UTC+2, Brian wrote: I think that I should probably add to my description.. what I would my goal is. My goal is for the HTML5 video to play in fullscreen mode, when the use presses the fullscreen button, but when the users presses the back button to dismiss the video, but still show the original webview. With the exception that i do not want to hide the video, if the MediaController is currently visible in front of the video, in that case only the MediaController should get hidden (which happens automatically) On Tuesday, May 22, 2012 11:31:38 PM UTC+2, Brian wrote: I think that I should probably add to my description.. what I would my goal is. My goal is for the HTML5 video to play in fullscreen mode, when the use presses the fullscreen button, but when the users presses the back button to dismiss the video, but still show the original webview. With the exception that i do not want to hide the video, if the MediaController is currently visible in front of the video, in that case only the MediaController should get hidden (which happens automatically) On Tuesday, May 22, 2012 11:31:38
[android-developers] Re: How to properly implement dismissing HTML5 video from WebView
Mariusz, I almost can. If you call getFocusedChild() on the FrameLayout, it returns a HTML5VideoFullScreen$SurfaceViewHolder object, which is an inner class of HTML5VideoFullScreen. I am not sure if there is way to access the HTML5VideoFullScreen object from that SurfaceViewHolder. However at this point, all these classes are private APIs, and using them would likely be dangerous code, since these are not interfaces that applications are suppose to be able to access. On Tuesday, May 22, 2012 7:07:24 PM UTC-4, Mariusz wrote: Brian, I have one question - are you able somehow to get access to Video object on 'onShowCustomView(View, CustomViewCallback)' method? In my case view returns FrameLayout and callback returns HTML5VideoFullScreen object. Thanks, Mariusz On Wednesday, May 23, 2012 12:40:16 AM UTC+2, Brian wrote: Mariusz, Thank you. I was getting hung up by the fact that I was specifically using the key listener to listen for KEYCODE_BACK, using the onBackPressed() method seems to solve my issue. Thank you. On Tuesday, May 22, 2012 5:37:55 PM UTC-4, Mariusz wrote: Hi, I implemented back action in the following way (activity level): @Override public void onBackPressed() { if(mCustomView != null mWebChromeClient != null) { mWebChromeClient.onHideCustomView(); } } ... at MyWebChromeClient level: @Override public void onHideCustomView() { if (mCustomView == null) return; mCustomView.setVisibility(View.GONE); mCustomViewContainer.removeView(mCustomView); mCustomView = null; mCustomViewContainer.setVisibility(View.GONE); mCustomViewCallback.onCustomViewHidden(); setStatusBarVisibility(true); mContentView.setVisibility(View.VISIBLE); } Regards, Mariusz On Tuesday, May 22, 2012 11:31:38 PM UTC+2, Brian wrote: I think that I should probably add to my description.. what I would my goal is. My goal is for the HTML5 video to play in fullscreen mode, when the use presses the fullscreen button, but when the users presses the back button to dismiss the video, but still show the original webview. With the exception that i do not want to hide the video, if the MediaController is currently visible in front of the video, in that case only the MediaController should get hidden (which happens automatically) On Tuesday, May 22, 2012 11:31:38 PM UTC+2, Brian wrote: I think that I should probably add to my description.. what I would my goal is. My goal is for the HTML5 video to play in fullscreen mode, when the use presses the fullscreen button, but when the users presses the back button to dismiss the video, but still show the original webview. With the exception that i do not want to hide the video, if the MediaController is currently visible in front of the video, in that case only the MediaController should get hidden (which happens automatically) On Tuesday, May 22, 2012 11:31:38 PM UTC+2, Brian wrote: I think that I should probably add to my description.. what I would my goal is. My goal is for the HTML5 video to play in fullscreen mode, when the use presses the fullscreen button, but when the users presses the back button to dismiss the video, but still show the original webview. With the exception that i do not want to hide the video, if the MediaController is currently visible in front of the video, in that case only the MediaController should get hidden (which happens automatically) On Tuesday, May 22, 2012 5:37:55 PM UTC-4, Mariusz wrote: Hi, I implemented back action in the following way (activity level): @Override public void onBackPressed() { if(mCustomView != null mWebChromeClient != null) { mWebChromeClient.onHideCustomView(); } } ... at MyWebChromeClient level: @Override public void onHideCustomView() { if (mCustomView == null) return; mCustomView.setVisibility(View.GONE); mCustomViewContainer.removeView(mCustomView); mCustomView = null; mCustomViewContainer.setVisibility(View.GONE); mCustomViewCallback.onCustomViewHidden(); setStatusBarVisibility(true); mContentView.setVisibility(View.VISIBLE); } Regards, Mariusz On Tuesday, May 22, 2012 11:31:38 PM UTC+2, Brian wrote: I think that I should probably add to my description.. what I would my goal is. My goal is for the HTML5 video to play in fullscreen mode, when the use presses the fullscreen button, but when the users presses the back button to dismiss the video, but still show the original webview. With the exception that i do not want to hide the video, if the MediaController is currently visible in front of the video, in that case only the MediaController should get hidden (which happens automatically) On Tuesday, May 22, 2012 11:31:38 PM UTC+2, Brian