X-Git-Url: http://p2p-next.cs.pub.ro/gitweb/?a=blobdiff_plain;f=js%2Fjquery.ui.nsvideo.js;h=e556fda937e233750913e1ab0040e37ba7343d41;hb=3177ec9aa46ca4feeb9eda48d9b6bce66a722f42;hp=1a026f5cc169ac599dded62c65d92bcf2ae0f3cd;hpb=e47a97763d745e654ab60c17a85d794b46734ddf;p=living-lab-site.git diff --git a/js/jquery.ui.nsvideo.js b/js/jquery.ui.nsvideo.js index 1a026f5..e556fda 100644 --- a/js/jquery.ui.nsvideo.js +++ b/js/jquery.ui.nsvideo.js @@ -1,5 +1,5 @@ /* - * jQuery UI NS-Video @VERSION + * jQuery UI NS-Video 1.0.0 beta * * Copyright 2011, Călin-Andrei Burloiu * Dual licensed under the MIT or GPL Version 2 licenses. @@ -10,49 +10,30 @@ * jquery.ui.core.js * jquery.ui.widget.js */ - -function padWithZeros(number, length) -{ - if (!length) - length = 2; - - var str = ''; - - if (isNaN(number)) - { - for (var i=0; i') + widget.$videoContainer = $('
') .appendTo(widget.element); widget.$progressContainer = $('
') .appendTo(widget.element); @@ -63,7 +44,7 @@ $.widget( "ui.nsvideo", { widget.$controls = $('
') .appendTo(widget.element); - widget.setVideo(); + widget.video(); // Time progress slider with load progress also widget.$loadedProgress @@ -75,47 +56,61 @@ $.widget( "ui.nsvideo", { .slider({ value: 0, min: 0, - max: 1000, //Math.floor(widget.$video[0].duration), + max: 1000, slide: function(event, ui) { - widget.$video[0].currentTime = - ui.value / 1000 * widget.$video[0].duration; + widget.videoPlugin('crtTime', [ui.value]); + widget.videoPlugin('refreshTime'); + widget.videoPlugin('refreshState'); } }); // Play / Pause - $('') + $('') .appendTo(widget.$controls) .button({ text: false, icons: { primary: "ui-icon-play" } }) .click(function() { - widget.togglePlay(); + widget.videoPlugin('togglePlay'); }); // Time information (current and total) - $('
--:-- / --:--
') + widget.$time = $('
00:00 / ' + widget.options.initialDuration + '
') .appendTo(widget.$controls); + + // Full screen + $('') + .appendTo(widget.$controls) + .button({ + text: false, + icons: { primary: "ui-icon-arrow-4-diag" } + }) + .click(function() { + widget.videoPlugin('fullscreen'); + }); - // Video definition buttonset + // Video format buttonset if (typeof widget.options.src == 'object') { - var $definitions = $('
') + var $formats = $('
') .appendTo(widget.$controls); - $definitions = $('.ui-nsvideo-definitions', $definitions[0]); + $formats = $('.ui-nsvideo-formats', $formats[0]); $.each(widget.options.src, function(index, value) { - id = widget.element.attr('id') + '-def-' + index; - $('') - .appendTo($definitions) - .attr('checked', (index == widget.options.definition)) + id = widget.element.attr('id') + '-format-' + index; + definition = value.res.substring(value.res.indexOf('x')+1)+'p'; + $('') + .appendTo($formats) + .attr('checked', (index == widget.options.srcIndex)) .click(function() { - widget.setDefinition(index); + widget.videoPlugin('pause'); + widget.srcIndex(index); }); - $('') - .appendTo($definitions); + $('') + .appendTo($formats); }); - $definitions.buttonset(); + $formats.buttonset(); } // Volume @@ -126,22 +121,31 @@ $.widget( "ui.nsvideo", { min: 0, max: 100, slide: function(event, ui) { - widget.unmuteHtml5(); - widget.$video[0].volume = ui.value / 100; + widget.videoPlugin('volume', [ui.value]); } }); // Toggle Mute - $('') + $('') .appendTo(widget.$controls) .button({ text: false, icons: { primary: "ui-icon-volume-on" } }) .click(function() { - widget.toggleMute(); + widget.videoPlugin('toggleMute'); }); + // Status information + widget.$stateText = $('
...
') + .appendTo(widget.$controls) + .css('cursor', 'pointer') + .click(function() { + widget.videoPlugin('refreshAll'); + }); + if (! widget.options.showState) + widget.$stateText.hide(); + // Clear fix helper $('
') .appendTo(widget.$controls); @@ -152,6 +156,7 @@ $.widget( "ui.nsvideo", { }, _setOption: function( key, value ) { + // TODO if ( key === "TODO" ) { } @@ -159,264 +164,914 @@ $.widget( "ui.nsvideo", { this._super( "_setOption", key, value ); }, - setVideo: function() { + _leadingZeros: function(number, length) { + if (!length) + length = 2; + + var str = ''; + + if (isNaN(number)) + { + for (var i=0; i') + .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; + // HTML5 if (widget.options.type == 'ns-html5' || widget.options.type == 'html5') { - widget.$video = $('