Android WebView Turn off sound when exiting 4. Video Full Screen Add cookie

Source: Internet
Author: User

Full screen problem, can refer to http://bbs.csdn.net/topics/390839259, click

WebView = (WebView) Findviewbyid (r.id.webview); videoview = (framelayout) Findviewbyid (r.id.video_view); chromeclient = New Webchromeclient () {//@overridepublic void Onshowcustomview (view view, Customviewcallback callback) when playing a network video full screen will be called {if (islandport) {return;} Setrequestedorientation (Activityinfo.screen_orientation_landscape);//if (mycallback! = null) {// Mycallback.oncustomviewhidden ();//Mycallback = null;//return;//}webview.setvisibility (View.GONE); if (MyView! = null {Callback.oncustomviewhidden (); return;} Videoview.addview (view); MyView = View;mycallback = Callback;videoview.setvisibility (view.visible);} Private View MyView = null;private customviewcallback mycallback = null;public void Onhidecustomview () {if (MyView = = NULL ) {return;} else {//if (mycallback! = null) {//Mycallback.oncustomviewhidden ();//Mycallback = null;//}setrequestedorientation (Act ivityinfo.screen_orientation_portrait); myview.setvisibility (View.gone); Videoview.removeview (MyView); Videoview.setvisibility (VIew. GONE); webview.setvisibility (view.visible); Mycallback.oncustomviewhidden (); myView = null;}} @Overridepublic void Onreceivedtitle (WebView view, String title) {//TODO auto-generated method Stubsuper.onreceivedtitle (view, title), if (showtitle) {settitle (title);}}; WebSettings setting = Webview.getsettings (); Setting.setbuiltinzoomcontrols (false); Setting.setusewideviewport (True ); Setting.setloadwithoverviewmode (true); Setting.setcachemode (Websettings.load_no_cache); setting.setPluginState (pluginstate.on_demand);//Setting.setlayoutalgorithm (Layoutalgorithm.single_column); Supports content re-layout setting.setjavascriptenabled (true); setting.setjavascriptcanopenwindowsautomatically (true);

Note rotate the screen

Android:configchanges= "Orientation|keyboardhidden|screensize"

/** * This method is called when the screen switch is on or off * * @author * *  @Overridepublic void onconfigurationchanged (Configuration newconfig) { Super.onconfigurationchanged (Newconfig); if (newconfig.orientation = = Configuration.orientation_landscape) { Islandport = true;} else if (newconfig.orientation = = configuration.orientation_portrait) {Islandport = false;}}

and turn off the sound, now can refer to here http://blog.csdn.net/cuizm/article/details/42342505

Add a cookie http://blog.csdn.net/encienqi/article/details/7912733

Cookies are not recommended, it is really difficult to use, browser caching is a headache problem

Android WebView Turn off sound when exiting 4. Video Full Screen Add cookie

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.