X-Git-Url: http://p2p-next.cs.pub.ro/gitweb/?a=blobdiff_plain;f=js%2Fjquery.ui.nsvideo.js;h=fe65927c10e41060e01850cfd28363c47905ecc0;hb=9ace04ad2c3b74bf584e245e4beec5d547360b01;hp=ccb461d28f91016ab2403652d5ea170b2e31a8b0;hpb=9e326b335014eac0c6c6476402654b19c57a396f;p=living-lab-site.git diff --git a/js/jquery.ui.nsvideo.js b/js/jquery.ui.nsvideo.js index ccb461d..fe65927 100644 --- a/js/jquery.ui.nsvideo.js +++ b/js/jquery.ui.nsvideo.js @@ -97,8 +97,8 @@ $.widget( "ui.nsvideo", { .appendTo(widget.$controls); $formats = $('.ui-nsvideo-formats', $formats[0]); $.each(widget.options.src, function(index, value) { - id = widget.element.attr('id') + '-format-' + index; - definition = value.res.substring(value.res.indexOf('x')+1)+'p'; + var id = widget.element.attr('id') + '-format-' + index; + var definition = value.res.substring(value.res.indexOf('x')+1)+'p'; $('') .appendTo($formats) .attr('checked', (index == widget.options.srcIndex)) @@ -187,7 +187,7 @@ $.widget( "ui.nsvideo", { }, video: function() { - widget = this; + var widget = this; // Select video source. // If src option is string, that's the source. @@ -199,6 +199,21 @@ $.widget( "ui.nsvideo", { widget.$videoContainer.html(''); + // Install buttons or not supported message if required + if (typeof $.fn.nsinstall == 'function') + { + widget.$installContainer = $('
') + .appendTo(widget.$videoContainer); + widget.$installContainer + .nsinstall({ + type: widget.options.type, + hideIfAlreadyInstalled: true + }); + if (widget.$installContainer.nsinstall('option', 'error') + == 'already installed') + widget.$installContainer.hide(); + } + var width = widget.options.width; var height = widget.options.height; @@ -234,6 +249,10 @@ $.widget( "ui.nsvideo", { widget.html5.refreshVolume(); widget.html5.refreshState(); widget._setWidgetWidth(); + + if (widget.$video[0].error != 3 + && widget.$video[0].error != 4) + widget.$installContainer.hide(); }, seeked: function() { widget.html5.play(); @@ -269,7 +288,7 @@ $.widget( "ui.nsvideo", { }, seeking: function() { widget.html5.refreshState(); - }, + } }); } // VLC @@ -817,6 +836,11 @@ $.widget( "ui.nsvideo", { }, play: function() { + if(typeof widget.$video[0].playlist.isPlaying == 'undefined') + return widget; + + widget.$installContainer.hide(); + if (! widget.$video[0].playlist.isPlaying) widget.$video[0].playlist.play(); @@ -833,6 +857,9 @@ $.widget( "ui.nsvideo", { }, pause: function() { + if (typeof widget.$video[0].playlist === 'undefined') + return widget; + if (widget.$video[0].playlist.isPlaying) widget.$video[0].playlist.togglePause();