我是Android开发的新手,我想从dailymotion的嵌入式链接获得.m3u8链接,但我正在使用webview客户端,但我不知道怎么可能请帮助我,我被困2天谢谢我的代码是
public class WebViewActivity extends Activity implements DownloadListener {
private WebView webview;
private static final String TAG = "WebViewActivity";
private ProgressDialog progressBar;
WebViewActivity myContxt;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.activity_web_view);
init();
}
public void init()
{
myContxt=this;
webview = (WebView)findViewById(R.id.webview);
WebSettings settings = webview.getSettings();
settings.setJavaScriptEnabled(true);
webview.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY);
final AlertDialog alertDialog = new AlertDialog.Builder(this).create();
progressBar = ProgressDialog.show(myContxt, "WebView Example", "Loading...");
webview.setWebViewClient(new WebViewClient() {
public boolean shouldOverrideUrlLoading(WebView view, String url) {
Toast.makeText(myContxt,url,Toast.LENGTH_SHORT).show();
Log.w(TAG, "Processing webview url click...");
Log.w(TAG,url);
webview.setDownloadListener(myContxt);
view.loadUrl(url);
return true;
}
public void onPageStarted(WebView view, String url, Bitmap favicon) {
Log.w(TAG,url);
if (progressBar != null && progressBar.isShowing()) {
progressBar.dismiss();
}
progressBar = ProgressDialog.show(myContxt, "Application Name", "Loading...");
}
public void onPageFinished(WebView view, String url) {
Log.w(TAG,url);
Log.i(TAG, "Finished loading URL: " + url);
if (progressBar.isShowing()) {
progressBar.dismiss();
}
}
public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
Log.e(TAG, "Error: " + description);
Toast.makeText(myContxt, "Oh no! " + description, Toast.LENGTH_SHORT).show();
alertDialog.setTitle("Error");
alertDialog.setMessage(description);
alertDialog.setButton("OK", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
return;
}
});
alertDialog.show();
}
});
webview.loadUrl("http://www.dailymotion.com/embed/video/x2bnb3s");
}
@Override
public void onDownloadStart(String url, String userAgent, String contentDisposition, String mimetype, long contentLength) {
Log.w("m3u8888",url);
}