无法访问flowplayer api

时间:2011-08-17 15:33:41

标签: javascript flowplayer

我无法访问flowplayer API。函数flowplayer.isLoaded ()返回false,但播放器工作正常并播放所需的视频。我究竟做错了什么? 例:

<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<!-- A minimal Flowplayer setup to get you started -->


<!-- 
    include flowplayer JavaScript file that does  
    Flash embedding and provides the Flowplayer API.
-->
<script type="text/javascript" src="flowplayer-3.2.6.min.js"></script>

<!-- some minimal styling, can be removed -->
<link rel="stylesheet" type="text/css" href="style.css">

<!-- page title -->
<title>Minimal Flowplayer setup</title>

   </head><body>

    <a 
         href="http://localhost:8084/PlayerTest/content/some_video.flv"
         style="display:block;width:520px;height:330px"  
         id="player"> 
    </a> 

    <!-- this will install flowplayer inside previous A- tag. -->
    <script type="text/javascript">
        flowplayer("player", "../flowplayer-3.2.7.swf");
    </script>

    <script type="text/javascript">
        function gett(){
            var text=flowplayer("player").getStatus();

            document.getElementById("state").innerHTML="bstart: "+text.bufferStart+" bend: "+text.bufferEnd+" time: "+flowplayer().isLoaded();                
        }

    </script>
    <div id="state">state</div>
      <input type="button" value="get" onclick="gett();" />
     </body>

<head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <!-- A minimal Flowplayer setup to get you started --> <!-- include flowplayer JavaScript file that does Flash embedding and provides the Flowplayer API. --> <script type="text/javascript" src="flowplayer-3.2.6.min.js"></script> <!-- some minimal styling, can be removed --> <link rel="stylesheet" type="text/css" href="style.css"> <!-- page title --> <title>Minimal Flowplayer setup</title> </head><body> <a href="http://localhost:8084/PlayerTest/content/some_video.flv" style="display:block;width:520px;height:330px" id="player"> </a> <!-- this will install flowplayer inside previous A- tag. --> <script type="text/javascript"> flowplayer("player", "../flowplayer-3.2.7.swf"); </script> <script type="text/javascript"> function gett(){ var text=flowplayer("player").getStatus(); document.getElementById("state").innerHTML="bstart: "+text.bufferStart+" bend: "+text.bufferEnd+" time: "+flowplayer().isLoaded(); } </script> <div id="state">state</div> <input type="button" value="get" onclick="gett();" /> </body>

1 个答案:

答案 0 :(得分:0)

显然,玩家必须是'loaded' before the API is available。您可以以编程方式执行此操作。尽管由于自动播放,视频可能已经播放了。