Commit 6c59d976 authored by damienf's avatar damienf
Browse files

- test.html: use position rather than time to update slider

parent a4119701
...@@ -68,6 +68,7 @@ Insert MSComctlLib.Slider.2 activex control ...@@ -68,6 +68,7 @@ Insert MSComctlLib.Slider.2 activex control
var prevState = 0; var prevState = 0;
var monitorTimerId = 0; var monitorTimerId = 0;
var sliderScrolling = false; var sliderScrolling = false;
var ignoreSliderChange = false;
function updateVolume(deltaVol) function updateVolume(deltaVol)
{ {
...@@ -139,7 +140,8 @@ function doGo(targetURL) ...@@ -139,7 +140,8 @@ function doGo(targetURL)
var vlc = document.getElementById("vlc"); var vlc = document.getElementById("vlc");
var options = new Array(":vout-filter=deinterlace", ":deinterlace-mode=linear"); var options = new Array(":vout-filter=deinterlace", ":deinterlace-mode=linear");
vlc.playlist.clear(); vlc.playlist.clear();
vlc.playlist.add(targetURL, null, options); //vlc.playlist.add(targetURL, null, options);
vlc.playlist.add(targetURL);
vlc.playlist.play(); vlc.playlist.play();
if( monitorTimerId == 0 ) if( monitorTimerId == 0 )
{ {
...@@ -211,9 +213,11 @@ function onPlaying() ...@@ -211,9 +213,11 @@ function onPlaying()
{ {
// seekable media // seekable media
slider.Enabled = true; slider.Enabled = true;
slider.Max = vlc.input.length/1000; slider.Max = slider.width;
slider.Value = vlc.input.time/1000; ignoreSliderChange = true;
info.innerHTML = formatTime(vlc.input.time)+"/"+formatTime(vlc.input.length); slider.Value = vlc.input.position*slider.width;
ignoreSliderChange = false;
document.getElementById("info").innerHTML = formatTime(vlc.input.time)+"/"+formatTime(vlc.input.length);
} }
else else
{ {
...@@ -224,7 +228,7 @@ function onPlaying() ...@@ -224,7 +228,7 @@ function onPlaying()
slider.Enabled = false; slider.Enabled = false;
} }
liveFeedRoll = liveFeedRoll & 3; liveFeedRoll = liveFeedRoll & 3;
info.innerHTML = liveFeedText[liveFeedRoll++]; document.getElementById("info").innerHTML = liveFeedText[liveFeedRoll++];
} }
} }
}; };
...@@ -257,26 +261,31 @@ function onVLCStateChange() ...@@ -257,26 +261,31 @@ function onVLCStateChange()
}; };
function slider::Scroll() function slider::Scroll()
{ {
var newPos = slider.Value * 1000;
var vlc = document.getElementById("vlc"); var vlc = document.getElementById("vlc");
slider.Text = formatTime(newPos); var slider = document.getElementById("slider");
info.innerHTML = slider.Text+"/"+formatTime(vlc.input.length); var oldPos = vlc.input.position;
if( (vlc.input.state == 3) && (vlc.input.time != newPos) ) var newPos = slider.Value/slider.width;
if( (vlc.input.state == 3) && (oldPos != newPos) )
{ {
vlc.input.time = newPos; vlc.input.position = newPos;
slider.Text = formatTime(vlc.input.time);
document.getElementById("info").innerHTML = slider.Text+"/"+formatTime(vlc.input.length);
} }
sliderScrolling = true; sliderScrolling = true;
}; };
function slider::Change() function slider::Change()
{ {
var newPos = slider.Value * 1000; var vlc = document.getElementById("vlc");
var slider = document.getElementById("slider");
var oldPos = vlc.input.position;
var newPos = slider.Value/slider.width;
if( sliderScrolling ) if( sliderScrolling )
{ {
sliderScrolling = false; sliderScrolling = false;
} }
else if( (vlc.input.state == 3) && (vlc.input.time != newPos) ) else if( !ignoreSliderChange && (vlc.input.state == 3) && (oldPos != newPos) )
{ {
vlc.input.time = newPos; vlc.input.position = newPos;
} }
}; };
//--> //-->
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment