音频播放器随机停止在WebView中播放

时间:2018-04-01 12:33:38

标签: java android webview

我使用android webview创建了一个Android应用程序,显示了一个HTML,JS音频(收音机)播放器。它在前20到30分钟播放然后停止。我认为这是HTML,JS但是当我在计算机上打开它并播放音频的时间相同时它并没有停止。这让我相信我创建的webview有问题。有人可以看看我的代码并告诉我我做错了什么吗? webview是否可能刷新页面或类似的内容?

谢谢,

科里

package com.madcreationapps.talayradioapp;

import android.app.ActionBar;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.Window;
import android.webkit.WebView;
import android.webkit.WebViewClient;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        WebView webView= (WebView)findViewById(R.id.webView);
//findViewById returns an instance of View ,which is casted to target class

        webView.setWebViewClient(new WebViewClient());

        webView.getSettings().setJavaScriptEnabled(true);
//This statement is used to enable the execution of JavaScript.

        webView.setVerticalScrollBarEnabled(false);
//This statement hides the Vertical scroll bar and does not remove it.

        webView.setHorizontalScrollBarEnabled(false);
//This statement hides the Horizontal scroll bar and does not remove it.

        webView.loadUrl("http://surf.hotspotmediaradio.com/");
//This statement hides the scroll bar and does not remove it.
    }
}

0 个答案:

没有答案