Android webview switches the screen through html5 to play online videos, and webviewhtml5

Source: Internet
Author: User

Android webview switches the screen through html5 to play online videos, and webviewhtml5

1. Add Network Access Permissions

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


2. Add full screen support developer official documentation for webview. Descriptions of html5 video playback are as follows: In order to support inline HTML5 video in your application, you need to have hardware acceleration turned on, and set WebChromeClient. For full screen support, implementations onShowCustomView(View, WebChromeClient.CustomViewCallback)And onHideCustomView()Are required, getVideoLoadingProgressView()Is optional.1) Enable hardware acceleration

2) rewrite the WebChromeClientonShowCustomView(View, WebChromeClient.CustomViewCallback)And onHideCustomView ()

Load the dashboard layout through onShowcustomView to hide the dashboard layout. Exit full screen playback in onHideCustomeView to re-display the dashboard layout.


Refer:

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

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


Why does Android WebView play html5 videos?

Software compatibility Optimization
 
Android webview embedded html page to play remote video files

WEBVIEW can be used on android terminals. WEBVIEW can load websites on your server and upload videos. The client can directly play online videos. Of course, you can also download and play the videos, it is done using an input/output stream. You can choose to use HTTP to access website resources, or use socket

Related Article

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.