Я создал веб-просмотр и обновил android:hardwareAccelerated="true"
для запуска встроенного тега видео, но;работает только звук без видео
mWebview = findViewById(R.id.webView);
mWebview.getSettings().setJavaScriptEnabled(true);
mChromeClient = new MyChromeClient(this);
mWebview.setWebChromeClient(mChromeClient);
mWebview.getSettings().setLoadWithOverviewMode(true);
mWebview.getSettings().setMediaPlaybackRequiresUserGesture(false);
mWebview.getSettings().setPluginState(WebSettings.PluginState.ON);
mWebview.getSettings().setRenderPriority(WebSettings.RenderPriority.HIGH);
mWebview.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
mWebview.getSettings().setDomStorageEnabled(true);
mWebview.getSettings().setAllowFileAccess(true);
mWebview.getSettings().setSavePassword(false);
mWebview.getSettings().setUseWideViewPort(true);
mWebview.getSettings().setBuiltInZoomControls(false);
mWebview.getSettings().setSupportZoom(false);
mWebview.getSettings().setNeedInitialFocus(false);
mWebview.getSettings().setLoadWithOverviewMode(true);
mWebview.getSettings().setLayoutAlgorithm(WebSettings.LayoutAlgorithm.NORMAL);
mWebview.getSettings().setLoadsImagesAutomatically(true);
CookieManager.getInstance().setAcceptCookie(true);
if (Build.VERSION.SDK_INT >= 17) {
mWebview.getSettings().setMediaPlaybackRequiresUserGesture(false);
}
mWebview.setLayerType(1, null);
mWebview.setWebViewClient(new MyWebviewClient());
String myvar = "";
String head = "<!DOCTYPE html><html><head><meta name=\"viewport\" content=\"width=device-width, user-scalable=yes\" /></head>";
String summary = "<style>table{ height:100%;}td.height{height:100%;}</style><table width=100% height=100%> <tr><td class=\"height\" style=\"text-align: center; vertical-align: middle;\"><video id='my-video' poster=\"\" controls autoplay style=\"width: 300px; height: 250px;vertical-align: middle;\"><source src='http://techslides.com/demos/sample-videos/small.mp4' type='video/mp4' /></video></td></tr></table><script>var myvideo = document.getElementsByTagName('video')[0]; myvideo.play()</script>";
String html = head + "<body style='background-color:#000000;'>" + summary + "</body></html>";
mWebview.loadData(html, "text/html", null);
adb log:
09/16 22:39:14: Launching app
$ adb install-multiple -r -t -p com.example.ad.myapplication F:\new\MyApplication\app\build\outputs\apk\debug\app-debug.apk
Split APKs installed
$ adb shell am start -n "com.example.ad.myapplication/com.example.ad.myapplication.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Client not ready yet..Waiting for process to come online
Connected to process 3426 on device emulator-5554
Capturing and displaying logcat messages from application. This behavior can be disabled in the "Logcat output" section of the "Debugger" settings page.
D/MediaResourceGetter: no ethernet/wifi connection detected
W/MediaResourceGetter: non-file URI can't be read due to unsuitable network conditions
E/MediaResourceGetter: Unable to configure metadata extractor
[ 09-16 22:39:18.039 3426: 3478 D/ ]
HostConnection::get() New Host Connection established 0xa0f9b0b0, tid 3478
D/MediaPlayer: Couldn't open file on client side, trying server side
разрешения :
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
Посоветуйте, пожалуйста, как отобразить видео со звуком, а не только со звуком. Я опробовал все свои известные решения Заранее спасибо