diff --git a/index.html b/index.html index d81c043..6031061 100644 --- a/index.html +++ b/index.html @@ -436,7 +436,7 @@
0:00 -
+
0:00
diff --git a/src/player.js b/src/player.js index 0ecd8ca..535ba0f 100644 --- a/src/player.js +++ b/src/player.js @@ -670,9 +670,24 @@ function _initBarScrub(bar, fill, onMove) { fill.style.transition = ''; } } - bar.addEventListener('touchstart', e => { startScrub(getPos(e.touches[0].clientX)); e.stopPropagation(); }, {passive:true}); - bar.addEventListener('touchmove', e => { if(S._scrubbing) moveScrub(getPos(e.touches[0].clientX)); }, {passive:true}); - bar.addEventListener('touchend', e => { if(S._scrubbing) endScrub(getPos(e.changedTouches[0].clientX)); }, {passive:true}); + // Touch: require ≥8px horizontal drag before committing to scrub. + // A plain tap cancels cleanly without seeking. + let _touchStartX = 0, _touchMoved = false; + bar.addEventListener('touchstart', e => { + _touchStartX = e.touches[0].clientX; + _touchMoved = false; + e.stopPropagation(); + }, {passive:true}); + bar.addEventListener('touchmove', e => { + const dx = Math.abs(e.touches[0].clientX - _touchStartX); + if (!_touchMoved && dx >= 8) { _touchMoved = true; startScrub(getPos(e.touches[0].clientX)); } + if (_touchMoved && S._scrubbing) moveScrub(getPos(e.touches[0].clientX)); + }, {passive:true}); + bar.addEventListener('touchend', e => { + if (_touchMoved && S._scrubbing) endScrub(getPos(e.changedTouches[0].clientX)); + else S._scrubbing = false; + _touchMoved = false; + }, {passive:true}); bar.addEventListener('mousedown', e => { startScrub(getPos(e.clientX)); e.preventDefault(); const mm = e2 => { if(S._scrubbing) moveScrub(getPos(e2.clientX)); };