2011-03-17 66 views
1

我嘗試播放使用JW播放器(V 88年2月4日) 頁面加載一個FLV的視頻我不能讓在頁面加載我的代碼自動播放,即使我的代碼看起來OK播放視頻。汽車在JW球員

我也越來越球員是在IE空或不是對象。如果我添加一個按鈕,並調用播放()上的點擊,在視頻開始播放。

我使用JQuery,.NET 4.0 & C#

這裏是我的代碼:

<script type="text/javascript"> 
     var player; 
     function playerReady(thePlayer) { 
     //this gets fired in IE, FF 
     player = window.document[thePlayer.id];   
     } 
     function createPlayer() { 
     var flashvars = { autostart: "true", skin: "http://localhost/app/Binn/flv/modieus.swf", lightcolor: "33cc00", frontcolor: "cccccc", quality: "true" } 
     var params = { allowfullscreen: "true", allowscriptaccess: "always", wmode: "opaque" } 
     var attributes = { id: "player1", name: "player1" } 
     swfobject.embedSWF("/app/Binn/flv/player.swf", "VPlayer", "717", "420", "10.0.1", false, flashvars, params, attributes); 
     }  

     function Play() { 
     //this line gives error in IE saying player is null or not an object 
     player.sendEvent('LOAD', 'http://localhost/kvs/u/bob/soccer.flv'); 
     } 
     $(function() { 
     alert('Creating the player on page load'); 
     createPlayer(); 
     }); 
     $(window).load(function() { 
     alert('window loaded, so auto playing video'); 
     Play(); 
     }); 
    </script> 

<div id="VPlayer"></div> 

回答

0

花了幾個小時後,我已經找到了空問題的解決方案...

可以防止空錯誤加入了「& NBSP;」在容器中的div標籤之間:

<div id="container">&nbsp;</div> 

它是有趣的,但解決自己的問題......