2011-07-06 40 views
0

我試圖顯示嵌入的YouTube視頻頁面。我從YouTube網站獲得了代碼。當我在瀏覽器中加載頁面時,頁面會正確顯示,但在我的嵌入式網頁上,YouTube視頻不會顯示第一幀。它只是一個底部帶有YouTube徽標的黑盒子。如果你點擊它,它確實播放視頻。我踩到啓用Java腳本,仍然沒有工作。Android,試圖在網頁中嵌入YouTube視頻

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"); 
    } 
} 

回答

0

嘗試在頁面源iframe標籤的src屬性嵌入&autoplay=1

即便如此,自動播放功能在Android 2.1設備上無法使用,因爲它們無法在瀏覽器中支持HTML5視頻。