Kotlin:Webview灰色播放按钮背景

时间:2018-10-16 18:08:01

标签: javascript android video webview kotlin

使用适用于Android TV的基于Kotlin的网络视图应用程序,并尝试删除在视频加载时显示的该死的低分辨率播放图标。本质上,尝试实施本文中的代码无济于事:Android WebView gray play button

示例:灰色播放图标BG: Example: Grey Play Icon BG

有机会有人可以帮助我吗?我从下面的mainactivity中粘贴了代码。似乎无法找出从原始SO帖子中插入修订的位置。谢谢!

package com.polychroma.tv

import android.app.Activity
import android.os.Bundle
import android.view.View
import android.webkit.WebChromeClient
import kotlinx.android.synthetic.main.tv_polychroma_full_screen.*

class MainActivity : Activity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)

        setContentView(R.layout.tv_polychroma_full_screen)
        actionBar?.setDisplayHomeAsUpEnabled(false)

        web_view_ad.systemUiVisibility =
                View.SYSTEM_UI_FLAG_LOW_PROFILE or
                        View.SYSTEM_UI_FLAG_FULLSCREEN or
                        View.SYSTEM_UI_FLAG_LAYOUT_STABLE or
                        View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY or
                        View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION or
                        View.SYSTEM_UI_FLAG_HIDE_NAVIGATION

        val webSettings = web_view_ad.settings
        webSettings.javaScriptEnabled = true
        webSettings.mediaPlaybackRequiresUserGesture = false
        webSettings.javaScriptCanOpenWindowsAutomatically = true
        webSettings.setUserAgentString("Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36")
        webSettings.useWideViewPort = true
        webSettings.builtInZoomControls = false
        webSettings.loadWithOverviewMode = false
        webSettings.domStorageEnabled = true
        webSettings.setAppCacheEnabled(true)
        webSettings.setSupportMultipleWindows(true)
        web_view_ad.webChromeClient = WebChromeClient()
        web_view_ad.isHardwareAccelerated
        web_view_ad.setInitialScale(1)
        web_view_ad.isVerticalScrollBarEnabled = false
        web_view_ad.isHorizontalScrollBarEnabled = false
        web_view_ad.loadUrl("https://live.polychroma.tv/m/#01")

    }

    override fun onPostCreate(savedInstanceState: Bundle?) {
        super.onPostCreate(savedInstanceState)

    }

    companion object {
        /**
         * Whether or not the system UI should be auto-hidden after
         * [AUTO_HIDE_DELAY_MILLIS] milliseconds.
         */
        private val AUTO_HIDE = true

        /**
         * If [AUTO_HIDE] is set, the number of milliseconds to wait after
         * user interaction before hiding the system UI.
         */
        private val AUTO_HIDE_DELAY_MILLIS = 3000

        /**
         * Some older devices needs a small delay between UI widget updates
         * and a change of the status and navigation bar.
         */
        private val UI_ANIMATION_DELAY = 300
    }
}

0 个答案:

没有答案