English 中文(简体)
视像
原标题:video can t play in webview

我把一个网站放到网上。 这是网上的一个录像。 录像带的形式为4。 我将这一资源列入海底项目“资产”档案。 现在,我可以扫描网站,但录像可起作用。 当我使用该密码mWebView.load Url(“file http:///android_asset/demo/html/demo.html”时,该录像可起作用。 如果我使用该密码mWebView.loadUrl(http://v.youku.com/v_playlist/f16642432o1p0.html);该录像可在网上播放。 德米.html可由IE9和Chrome开放。 我和roid版是3.1。

    webview = (WebView) findViewById(R.id.webView);
    webSettings = webview.getSettings();

    webSettings.setLayoutAlgorithm(LayoutAlgorithm.NARROW_COLUMNS); 
    webSettings.setBuiltInZoomControls(true); 
    webSettings.setJavaScriptEnabled(true); 
    webSettings.setJavaScriptCanOpenWindowsAutomatically(true);
    webSettings.setPluginState(PluginState.ON);
    webSettings.setPluginsEnabled(true);
    webSettings.setAllowFileAccess(true);

    webview.loadUrl("file:///android_asset/demo/html/demo.html");
    //webview.setWebChromeClient(new MyChromeClient());
    //webview.setWebViewClient(new MyWebClient());
问题回答

假定你想要拍摄任何嵌入式录像,你必须做两件事:

  1. 在《roid宣言》中,有<代码>android:hardwareAccelerated=“true”:

    <application android:icon="@drawable/icon" android:label="@string/app_name" android:hardwareAccelerated="true">
    <activity android:name=".Activity"
        android:label="@string/app_name" android:configChanges="orientation|keyboardHidden">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    

  2. 你在主要活动中已经做些什么:

    WebSettings w = webView.getSettings();      
    w.setPluginState(PluginState.ON);
    

还必须启动硬件加速,以便从旧的安乐器上运行,即使这一选择只出现在安的3.0+中。 我猜测,你不得不在1.0-2.3.3号法典中说明这一点,但如果你在3.0+上回来的话,它会这样做。

Hope it helps!





相关问题
Android - ListView fling gesture triggers context menu

I m relatively new to Android development. I m developing an app with a ListView. I ve followed the info in #1338475 and have my app recognizing the fling gesture, but after the gesture is complete, ...

AsyncTask and error handling on Android

I m converting my code from using Handler to AsyncTask. The latter is great at what it does - asynchronous updates and handling of results in the main UI thread. What s unclear to me is how to handle ...

Android intent filter for a particular file extension?

I want to be able to download a file with a particular extension from the net, and have it passed to my application to deal with it, but I haven t been able to figure out the intent filter. The ...

Android & Web: What is the equivalent style for the web?

I am quite impressed by the workflow I follow when developing Android applications: Define a layout in an xml file and then write all the code in a code-behind style. Is there an equivalent style for ...

TiledLayer equivalent in Android [duplicate]

To draw landscapes, backgrounds with patterns etc, we used TiledLayer in J2ME. Is there an android counterpart for that. Does android provide an option to set such tiled patterns in the layout XML?

Using Repo with Msysgit

When following the Android Open Source Project instructions on installing repo for use with Git, after running the repo init command, I run into this error: /c/Users/Andrew Rabon/bin/repo: line ...

Android "single top" launch mode and onNewIntent method

I read in the Android documentation that by setting my Activity s launchMode property to singleTop OR by adding the FLAG_ACTIVITY_SINGLE_TOP flag to my Intent, that calling startActivity(intent) would ...

From Web Development to Android Development

I have pretty good skills in PHP , Mysql and Javascript for a junior developer. If I wanted to try my hand as Android Development do you think I might find it tough ? Also what new languages would I ...

热门标签