2010-12-03 44 views
0

我已將JW HTML5播放器整合到我的jQuery Cycle滑塊中。問題是如果我將視頻設置爲自動播放,當頁面加載時播放,而不是當幻燈片進入視圖時 - Flash視頻會發生什麼情況。有沒有辦法阻止HTML5視頻播放,直到顯示幻燈片?滑塊中的HTML5視頻自動播放問題

這是我使用的代碼:

<video id="video-'.$video_name.'" width="'.$width.'" height="'.$height.'" poster="'.get_bloginfo('template_directory') .'/lib/scripts/timthumb.php?src='.$image.'&h='.$height.'&w='.$width.'&zc=1" controls="controls"> 

       <source src="'.$html5_1.'" type="video/mp4" /> 
       <source src="'.$html5_1.'" type="video/webm" /> 
       <source src="'.$html5_2.'" type="video/ogg" /> 

      </video> 

      <script> 
       jwplayer("video-'.$video_name.'").setup({ 
        file: "'.$url.'", 
        image: "'.get_bloginfo('template_directory') .'/lib/scripts/timthumb.php?src='.$image.'&h='.$height.'&w='.$width.'&zc=1", 
        icons: "'.$icons.'", 
        autostart: "'.$autostart.'", 
        stretching: "'.$stretching.'", 
        controlbar: "'.$controlbar.'", 
        skin: "'.$skin.'", 
        screencolor: "white", 
        height: '.$height.', 
        width: '.$width.', 
        players: [';      
        if($fallback == "flash") { 
         $out .= '{type: "html5"}, {type: "flash", src: "'.get_bloginfo("template_directory").'/lib/scripts/mediaplayer/player.swf"}'; 
        } elseif($fallback == "html5") { 
         $out .= '{type: "flash", src: "'.get_bloginfo("template_directory").'/lib/scripts/mediaplayer/player.swf"}, { type: "html5" },'; 
        } 
        $out .= '] 
       }); 
      </script>'; 

回答

0

video標籤Attributepreload="auto"

裝載屬性,指定是否以及如何筆者認爲視頻應該被加載的頁面加載時。默認值爲preloadnone您可以將其設置爲metadataauto