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