webview androidtv无法启动离线视频

时间:2019-03-18 14:39:32

标签: android webview

我有一个HTML视频播放器,服务工作者可以在android离线手机上正常工作,我的问题出在androidTv / TvBox TX2上,当它处于离线模式时,视频通过时就好像缺少播放的内容,但是但是,当网络正常连接时,Service Worker工作正常。我该如何解决这个问题?

    super.onCreate(savedInstanceState);
    this.requestWindowFeature(Window.FEATURE_NO_TITLE);
    getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
    setContentView(R.layout.activity_main);

    webView = (WebView) findViewById(R.id.webView);
    WebViewClient webViewClient = (new WebViewClient());

    webView.setWebViewClient(webViewClient);

    WebSettings ws = webView.getSettings();
    ws.setJavaScriptEnabled(true);
    ws.setSupportZoom(false);
    ws.setDomStorageEnabled(true);
    ws.setLoadsImagesAutomatically(false);
    ws.setMediaPlaybackRequiresUserGesture(false);
    ws.setRenderPriority(WebSettings.RenderPriority.HIGH);

    webView.loadUrl("LINK HTTPS");
}

@Override
public void onStop()
{
    try
    {
        Thread.sleep(5000);
    } catch (InterruptedException e) {
        e.printStackTrace();
    }
    super.onStop();
    Intent i = new Intent(this, MainActivity.class);
    startActivity(i);
    finish();
}

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

0 个答案:

没有答案