gpt4 book ai didi

android - 无法在 WebView 上从 vimeo 流式传输视频

转载 作者:行者123 更新时间:2023-11-29 14:16:02 25 4
gpt4 key购买 nike

我正在开发一个应用程序,它需要流式传输在 vimeo 网站上上传的视频。当我从我的一项 Activity 启动 webview 时,vimeo 站点成功加载到 webview 上,但问题从这里开始。当我点击播放图标时,它不会再移动。加载的 vimeo 视频页面不播放视频。

我试过检查是不是Android本身的问题,但证明是错误的。如果我单独将网址复制到Android浏览器并播放,则播放成功。这是我无能为力的地方,我是否遗漏了配置的 WebView 中的任何内容。

我的代码在这里:

private void getWebPage(final String webpage, final String param2, String param3) {
// TODO Auto-generated method stub

final FrameLayout.LayoutParams ZOOM_PARAMS =
new FrameLayout.LayoutParams(
ViewGroup.LayoutParams.WRAP_CONTENT,
ViewGroup.LayoutParams.WRAP_CONTENT,
Gravity.BOTTOM);
final Activity activity = this;
getWindow().setFeatureInt(Window.FEATURE_PROGRESS, Window.PROGRESS_VISIBILITY_ON);
mWebView = (WebView) findViewById(R.id.webview);


mWebView.setWebChromeClient(new WebChromeClient() {
public void onProgressChanged(WebView view, int progress) {

activity.setTitle(" Loading the content for... "+param2);
activity.setProgress(progress * 100);//Make the bar disappear after URL is loaded

// Return the app name after finish loading
if(progress == 100)
// activity.setTitle(R.string.app_name);
activity.setTitle("You are now viewing "+param2);

}
});

mWebView.setWebViewClient(new WebViewClient());
mWebView.getSettings().setJavaScriptEnabled(true);
mWebView.getSettings().setAppCacheEnabled(true);
mWebView.getSettings().setDomStorageEnabled(true);
mWebView.getSettings().setPluginState(WebSettings.PluginState.ON_DEMAND);
mWebView.getSettings().setLoadWithOverviewMode(true);

FrameLayout mContentView = (FrameLayout) getWindow().
getDecorView().findViewById(android.R.id.content);

mWebView.loadUrl(webpage);
//Intent newIntent = new Intent(Intent.ACTION_VIEW).setData(Uri.parse("http://vimeo.com/m/45057923"));
/*Intent newIntent = new Intent(Intent.ACTION_VIEW).setData(Uri.parse(webpage));
startActivity(newIntent);*/

}

最佳答案

它适用于

mWebView.getSettings().setPluginsEnabled(true);

关于android - 无法在 WebView 上从 vimeo 流式传输视频,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12440002/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com