JW播放器JavaScript API第不灵 [英] JW Player javaScript API not working

查看:435
本文介绍了JW播放器JavaScript API第不灵的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用jwplayer.version ='2295年5月10日和chrome浏览器25。

I use jwplayer.version = '5.10.2295' and browser chrome 25.

我的code:

jwplayer('container').setup({
    file: 'path...',
    width: '300px',
    height: '100px',
    autostart: true,
    modes: [
        { type: 'html5' },
        { type: 'flash', src: 'path...' }
    ]
});

当页面加载我的资源(MP4视频文件)开始correctrly展示区 - 这是确定。
但简单jwplayer JS API方法,如suche jwplayer()无反应。停止()为例。还有一些控制不可用(播放,顶部,搜索),而是全屏模式按钮的工作原理以及音量键。

When page is loaded my resource (mp4 video file) starts to show correctrly - it is ok. But there is no reaction on simple jwplayer JS API methods, suche as jwplayer().stop(), for example. And some controls are not available (play, top, seek), but 'to full screen mode' button works as well as volume button.

而最有意思的是,js的可用于视频后几秒钟API和控制按钮开始播放(如果浏览器缓存被清除),然后没有交互反应。但有些方法正确适用所有的时间(jwplayer()。setFullscreen()为例)。

And the most interesting is that js api and control buttons available for a few seconds after video start to play (if browser cache is cleared), and then no response for interaction. But some method works all the time correctly (jwplayer().setFullscreen() for example).

P.S。我看到相关的<一个href=\"http://stackoverflow.com/questions/9809438/javascript-api-not-working-for-chrome-or-safari-on-jw-player-5-9\">question但得到的答复是不深anough我。

p.s. I saw related question but the answer is not deep anough for me.

推荐答案

我找到了解决办法。

我的视频文件在路径中没有指定分机(我不是'路径/要/文​​件''路径/要/ file.mp4'),并且实际上在jwPlayer深处brokes事端。我们需要指定我们和操作文件的类型:

My video file have no specified extension in path (i have 'path/to/file' instead of 'path/to/file.mp4') and that fact brokes somethin in the depths of jwPlayer. We need to specify type of file we operate with:

jwplayer('container').setup({
    file: 'path/to/file-with-no-extension',
    width: '300px',
    height: '100px',
    autostart: true,
    type: 'video',  //helps jwplayer to determine how to handle our resource with no extension
    modes: [
        { type: 'html5' },
        { type: 'flash', src: 'path...' }
    ]
});

这是解决方案。

这篇关于JW播放器JavaScript API第不灵的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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