使用JW播放器禁用嵌入视频中的播放/暂停 [英] disabling play/pause in embedded video using JW player

查看:187
本文介绍了使用JW播放器禁用嵌入视频中的播放/暂停的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用JW(v 5.8)播放器嵌入视频。我想这样做是为了启用自动启动,允许视频在页面加载后立即开始播放,控制栏被禁用,以便观看者无法在点击视频中的随机点和点击播放/暂停功能视频已停用。要嵌入mp4视频,我正在使用JW播放器。
我设法完成了前2个任务,但是为了在点击屏幕时禁用播放/暂停功能,我试图使用clickproxy插件但它不起作用。我正在粘贴下面的代码:

I am using JW (v 5.8) player to embed a video. And I want to do it so that autostart is enabled, allowing the video to start playing as soon as the page loads, the controlbar is disabled so that a viewer cannot seek to a random point in a video and the play/pause function on clicking the video is disabled. To embed the mp4 video, I am using JW player. I managed to accomplish the first 2 tasks, but to disable the play/pause function on clicking the screen, I am trying to use the clickproxy plugin and it does not work. I am pasting my code below:

<div id="mediaplayer">JW Player goes here</div>

<script type="text/javascript" src="jwplayer.js"></script>
<script type="text/javascript">
    jwplayer('mediaplayer').setup({
        'flashplayer': 'player.swf',
        'file': 'video.mp4',
        'controlbar': 'none',
        'width': '1000',
        'height': '1000',
        'plugins': 'clickproxy',
        'clickproxy.listener': 'clickListener',
        'autostart': 'true'
    });
function clickListener(obj)
{
}
</script>

现在使用此代码,视频加载,但甚至没有开始播放,点击由于clickproxy插件,视频没有做任何事情。无论如何要完成我想要的?
我是javascript的新手,所以任何帮助都会非常感激!

Right now with this code, the video loads, but doesn't even start playing, and clicking on the video doesn't do anything because of the clickproxy plugin. Anyway to accomplish what I want? I am a newbie in javascript, so any help will be really appreciated!

谢谢!

推荐答案

啊,是的,玩家曾经有过这样的功能(关于忽略点击),但它似乎一直被删除。

Ahhh yes, there used to be functionality in the player to do this (about ignoring the click) but it seems it keeps getting removed.

这是我刚刚实现的解决方案,我只需插入onPause javascript事件并重新开始播放媒体。

Here's the solution I've just implemented that works for me, I simply plug into the onPause javascript event and start the media playing again.

    <script type='text/javascript'>
  jwplayer('mediaspace').setup({
    'flashplayer': '/jw/player.swf',
    'file': 'http://d3usowdy51yate.cloudfront.net/your-mp4-goes-here.mp4',
    'autostart': 'true',
    'icons': 'true',
    'stretching': 'fill',
    'controlbar': 'none',
    'width': '640',
    'height': '360',
    events: {
        onPause: function(event) {
          jwplayer('mediaspace').play();}
    }
  });
</script>

这篇关于使用JW播放器禁用嵌入视频中的播放/暂停的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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