Android WebView switch large screen via HTML5 play online video

Source: Internet
Author: User

1. Add Network access rights

<uses-permission android:name= "Android.permission.INTERNET"/>


2. WebView Add full screen supportDeveloper official documentation about HTML5 supported video playback is described as follows: In order-to-support-inline HTML5 video in your application, you need to has hardware a Cceleration turned on, and set aWebChromeClient. For full screen support, implementations ofonShowCustomView(View, WebChromeClient.CustomViewCallback) andonHideCustomView()is required,getVideoLoadingProgressView()is optional.1) Turn on hardware acceleration

2) rewrite the webchromeclient onShowCustomView(View, WebChromeClient.CustomViewCallback) and Onhidecustomview ()

Onshowcustomview the layout of the large screen, hide the small screen layout, exit full-screen playback in Onhidecustomeview, and re-display the small screen layout


Reference:

Http://developer.android.com/reference/android/webkit/WebView.html

http://stackoverflow.com/questions/12708890/youtube-video-not-playing-in-webview-android/12850816#12850816

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.