获得视频播放器擦洗器

时间:2014-08-07 05:02:27

标签: javascript video-player

我需要播放视频的持续时间。这可能吗?我看到了这个Jsfiddle代码来获取时间,但没有成功。

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>TEST</title>
<script>
    function jsCallbackReady(pid){
        alert(pid);
    }
    function freePreviewEndHandler() {
            kdp.sendNotification('doPause');
            var time = this.kdp.evaluate('{video.player.currentTime}');
        }
</script>
</head>
<body>
    <button id="seaButton" class="searchButtonClass" type="button" onclick="freePreviewEndHandler()">Get Time</button>

    <object id="My-player_1406035922" name="My-player_1406035922" type="application/x-shockwave-flash" allowFullScreen="true" allowNetworking="all" allowScriptAccess="always" height="333" width="400" bgcolor="#000000" style="width: 400px; height: 333px;" xmlns:dc="http://purl.org/dc/terms/" xmlns:media="http://search.yahoo.com/searchmonkey/media/" rel="media:video" resource="https://video.konnectcorp.com/index.php/kwidget/cache_st/1406035922/wid/_103/uiconf_id/14969193/entry_id/0_57arhuzr" data="https://video.konnectcorp.com/index.php/kwidget/cache_st/1406035922/wid/_103/uiconf_id/14969193/entry_id/0_57arhuzr">
    <param name="allowFullScreen" value="true" />
    <param name="allowNetworking" value="all" />
    <param name="allowScriptAccess" value="always" />
    <param name="bgcolor" value="#000000" />
    <param name="flashVars" value="emptyF=onKdpReady&readyF=onKdpReady&streamerType=rtmp&mediaProtocol=rtmpe" />
    <param name="movie" value="https://video.konnectcorp.com/index.php/kwidget/cache_st/1406035922/wid/_103/uiconf_id/14969193/entry_id/0_57arhuzr" />

    <a rel="media:thumbnail" href=""></a>
    <span property="dc:description" content=""></span>
    <span property="media:title" content="Wildlife"></span>
    <span property="media:width" content="400"></span>
    <span property="media:height" content="333"></span>
    <span property="media:type" content="application/x-shockwave-flash"></span> 

1 个答案:

答案 0 :(得分:0)

问题是kdp没有定义,你可能在http页面使用https swf(协议必须相同)

<head>
<script>
    function jsCallbackReady(pid){
       kdp = document.getElementById(pid);
    }
    function freePreviewEndHandler() {
            kdp.sendNotification('doPause');
            var time = this.kdp.evaluate('{video.player.currentTime}');
        }
</script>
</head>
<body>
    <button id="seaButton" class="searchButtonClass" type="button" onclick="freePreviewEndHandler()">Get Time</button>

    <object id="My-player_1406035922" name="My-player_1406035922" type="application/x-shockwave-flash" allowFullScreen="true" allowNetworking="all" allowScriptAccess="always" height="333" width="400" bgcolor="#000000" style="width: 400px; height: 333px;" xmlns:dc="http://purl.org/dc/terms/" xmlns:media="http://search.yahoo.com/searchmonkey/media/" rel="media:video" resource="http://video.konnectcorp.com/index.php/kwidget/cache_st/1406035922/wid/_103/uiconf_id/14969193/entry_id/0_57arhuzr" data="http://video.konnectcorp.com/index.php/kwidget/cache_st/1406035922/wid/_103/uiconf_id/14969193/entry_id/0_57arhuzr">
    <param name="allowFullScreen" value="true" />
    <param name="allowNetworking" value="all" />
    <param name="allowScriptAccess" value="always" />
    <param name="bgcolor" value="#000000" />
    <param name="flashVars" value="emptyF=onKdpReady&readyF=onKdpReady&streamerType=rtmp&mediaProtocol=rtmpe" />
    <param name="movie" value="http://video.konnectcorp.com/index.php/kwidget/cache_st/1406035922/wid/_103/uiconf_id/14969193/entry_id/0_57arhuzr" />

    <a rel="media:thumbnail" href=""></a>
    <span property="dc:description" content=""></span>
    <span property="media:title" content="Wildlife"></span>
    <span property="media:width" content="400"></span>
    <span property="media:height" content="333"></span>
    <span property="media:type" content="application/x-shockwave-flash"></span>
</object>
</body>