[vlc-devel] [PATCH] luahttp: Don't interfere with seek slider either

Edward Wang edward.c.wang at compdigitec.com
Fri May 25 00:30:50 CEST 2012


Ref #6652
---
 BP requested

 share/lua/http/js/controlers.js |    8 +++++---
 share/lua/http/js/ui.js         |    9 +++++++--
 2 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/share/lua/http/js/controlers.js b/share/lua/http/js/controlers.js
index c80be38..6ef5782 100644
--- a/share/lua/http/js/controlers.js
+++ b/share/lua/http/js/controlers.js
@@ -17,9 +17,11 @@ function updateStatus() {
                 $('#mediaTitle').append($('[name="filename"]', data).text());
                 $('#totalTime').append(format_time($('length', data).text()));
                 $('#currentTime').append(format_time($('time', data).text()));
-                $('#seekSlider').slider({
-                    value: toFloat($('position', data).text()) * 100
-                });
+                if (!$('#seekSlider').data('clicked')) {
+                    $('#seekSlider').slider({
+                        value: toFloat($('position', data).text()) * 100
+                    });
+                }
                 $('#currentVolume').append(Math.round($('volume', data).text() / 2.56) + '%');
                 /* Don't interfere with the user's action */
                 if (!$('#volumeSlider').data('clicked')) {
diff --git a/share/lua/http/js/ui.js b/share/lua/http/js/ui.js
index 3ba9e28..a1f88c8 100644
--- a/share/lua/http/js/ui.js
+++ b/share/lua/http/js/ui.js
@@ -4,6 +4,9 @@ $(function () {
         value: 0,
         min: 0,
         max: 100,
+        start: function (event, ui) {
+            $("#seekSlider").data( 'clicked', true );
+        },
         stop: function (event, ui) {
             $("#currentTime").empty().append(format_time(Math.round((ui.value / 100) * $('#seekSlider').attr('totalLength'))));
             switch (current_que) {
@@ -17,6 +20,7 @@ $(function () {
                 sendVLMCmd('control Current seek ' + ui.value);
                 break;
             }
+            $("#seekSlider").data( 'clicked', false );
         }
     });
     $("#volumeSlider").slider({
@@ -36,8 +40,9 @@ $(function () {
             $("#volumeSlider").data( 'clicked', false );
         }
     });
-    /* To ensure that updateStatus() doesn't interfere while use is
-     * sliding on the control. */
+    /* To ensure that updateStatus() doesn't interfere while the user
+     * slides the controls. */
+    $("#seekSlider").data( 'clicked', false );
     $("#volumeSlider").data( 'clicked', false );
     $('#buttonStop').click(function () {
         switch (current_que) {
-- 
1.7.5.4




More information about the vlc-devel mailing list