开发者

Android, Trying to embed YouTube video in webpage

I’m trying to display a page of embed YouTube videos. I got the code from YouTube website.开发者_运维问答 The page gets displayed correctly when I load it up in the browser but on my embedded web page the YouTube videos do not show the first frame. Its just a black box with the YouTube logo on the bottom. If you click on it, it does play the video. I tread to enable java script, still did not work.

public class cVideos extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.videos);

        WebView mWeb=(WebView) findViewById(R.id.webvideo);
        mWeb.getSettings().setJavaScriptEnabled(true);
        mWeb.getSettings().setJavaScriptEnabled(true);
    //    mWeb.loadUrl("http://www.besttechsolutions.biz/projects/bigbiz/mobvideo.php");
        mWeb.loadUrl("http://www.besttechsolutions.biz/projects/bigbiz/videored.php");
    }
}


Try embedding &autoplay=1 in the src attribute of the iframe tag in the page source.

Even so, autoplay will not work on Android 2.1 devices, as they cannot support HTML5 video in the browser.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜