Javascript API第不工作的Chrome或Safari浏览器上播放JW 5.9 [英] Javascript API not working for Chrome or Safari on JW Player 5.9

查看:152
本文介绍了Javascript API第不工作的Chrome或Safari浏览器上播放JW 5.9的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我工作的JW播放器显示当前曲目的标题和有播放/暂停,下一曲,previous曲目和音量切换按键的自定义界面。

I am working on a custom interface for the JW Player which displays the current track title and has play/pause, next track, previous track and volume toggle buttons.

它适用于IE8 / 9和FF失败时,Chrome和Safari。 Chrome的控制台提供了以下错误:未捕获类型错误:对象#没有方法'addControllerListener

It works for IE8/9 and FF but fails for Chrome and Safari. Chrome's console gives the following error: Uncaught TypeError: Object # has no method 'addControllerListener'

这是code我使用的测试。

This is the code I am using for testing.

<div id="container">Loading the player ...</div>
<script type="text/javascript">
    jwplayer("container").setup({
        image: "preview.jpg",
        height: 320,
        width: 480,
        modes: [
            { type: "html5" },
            { type: "flash", src: "player.swf" }
        ],
        'playlist': [
            { 'file': "audio/01.mp3", 'title': "Track 1" },
            { 'file': "audio/02.mp3", 'title': "Track 2" },
            { 'file': "audio/03.mp3", 'title': "Track 3" }
        ],
    });

    function playerReady(obj)
    {
        player = document.getElementById(obj.id);
        displayFirstItem();
    };

    function displayFirstItem()
    {
        try
        {
            playlist = player.getPlaylist();
        }
        catch(e)
        { 
            setTimeout("displayFirstItem()", 100);
        }

        player.addControllerListener('ITEM', 'itemMonitor');
        itemMonitor({index:0});
    };

    function itemMonitor(obj)
    {
        $('#nowplaying').html('<span><strong>Now Playing:</strong> ' + playlist[obj.index]['title'] + '</span>');
    };
</script>
<div id="nowplaying"></div>
<div class="control_bar">
    <ul>
         <li onclick='player.sendEvent("play");'>[ &#8250; ] Play / Pause</li>
         <li onclick='player.sendEvent("prev");'>[ &laquo; ] Previous item</li>
         <li onclick='player.sendEvent("next");'>[ &raquo; ] Next item</li>
    </ul>
</div>

我已经搜索并尝试了修改,比如增加了javascriptid参数,似乎没有任何的Chrome或Safari工作。

I have searched and tried several modifications, like adding the javascriptid parameter, nothing seems to work for Chrome or Safari.

任何想法?谢谢

推荐答案

删除 {键入:HTML5}

HTML5渲染与div的和img标记播放器和播放视频,它不支持所有Flash版本支持,其中包括JS API的部分。

HTML5 renders the player with divs and img tags and plays your videos and it doesn't support everything the flash version supports, including parts of the JS API.

这篇关于Javascript API第不工作的Chrome或Safari浏览器上播放JW 5.9的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆