jwplayer播放一个视频并停止所有其他视频



我的页面上有多个jwplayer视频,具有以下配置:

$(function(){
    //add attributes to your ".video" DIV placeholder to customimize output
    //example: data-autostart="true" - see customSettings Object below.
    if (typeof(jwplayer) !== 'undefined'){
        $('.video').each(function(){
            var vid = $(this),
            videoSettings = {},
            settings = {
                autostart: false,
                width: '100%',
                aspectratio: '16:9',
                image: ''
            },
            customSettings = {
                autostart: vid.attr('data-autostart'),
                width: vid.attr('data-width'),
                aspectratio: vid.attr('data-aspectratio'),
                image: vid.attr('data-image')
            };
            $.extend(videoSettings, settings, customSettings);
            var playerInstance = jwplayer( vid.attr('id') ).setup({
                primary: "flash",
                file: Drupal.settings.basePath + $(this).attr('data-src'),
                autostart: videoSettings.autostart,
                aspectratio: videoSettings.aspectratio,
                image: Drupal.settings.basePath + videoSettings.image,
                skin: "glow",
                stretching: "exactfit",
                width: videoSettings.width,
                ga:{idstring: videoSettings.videotitle,
                    trackingobject: "pageTracker"
                   }
            });
        });
    }
});

我试图添加这个:

                events: {
                    onReady: function ()
                    {
                        jwplayer($('.video').id).stop();
                    }
                },

但是我收到以下错误:

[.PPAPIContext]GL 错误 :GL_INVALID_ENUM : glTexImage2D: 目标已GL_TEXTURE_RECTANGLE_ARB

有没有办法让所有其他视频在播放时停止?

它对我有用...

  if(typeof jwplayer().stop === "function" ){
      jwplayer().stop();
  }

相关内容

最新更新