added note about browsers, added touch support for slider

This commit is contained in:
2019-05-29 20:17:59 +02:00
parent abfce0771c
commit 7bf981b296
2 changed files with 32 additions and 5 deletions

View File

@@ -12,6 +12,7 @@ let songDir = [];
let player = null; let player = null;
let aLoopTime = null; let aLoopTime = null;
let bLoopTime = null; let bLoopTime = null;
let sliderPause = false;
// init socket io // init socket io
$(function () { $(function () {
@@ -100,6 +101,34 @@ $(function () {
updateDisplay(); updateDisplay();
}); });
$( '#position-slider' ).on('touchend', function () {
if(sliderPause){
player.play();
sliderPause = false;
}
});
$( '#position-slider' ).on('touchstart', function () {
if(player.isPlaying()){
player.pause();
sliderPause = true;
}
});
$( '#position-slider' ).mouseup(function () {
if(sliderPause){
player.play();
sliderPause = false;
}
});
$( '#position-slider' ).mousedown(function () {
if(player.isPlaying()){
player.pause();
sliderPause = true;
}
});
$( '#speed-slider' ).change(function () { $( '#speed-slider' ).change(function () {
updateDisplay(); updateDisplay();
}); });
@@ -238,10 +267,8 @@ Player.prototype = {
html5: true, // Force to HTML5 so that the audio can stream in (best for large files). html5: true, // Force to HTML5 so that the audio can stream in (best for large files).
onplay: function() { onplay: function() {
updateDisplay(); updateDisplay();
console.log('pressed play button');
$( '#playBtn' ).removeClass('btn-succes').addClass('btn-warning'); $( '#playBtn' ).removeClass('btn-succes').addClass('btn-warning');
$( '#playBtn svg' ).removeClass('fa-play').addClass('fa-pause'); $( '#playBtn svg' ).removeClass('fa-play').addClass('fa-pause');
// Start upating the progress of the track.
requestAnimationFrame(self.step.bind(self)); requestAnimationFrame(self.step.bind(self));
}, },
onload: function() { onload: function() {

View File

@@ -11,7 +11,7 @@
<div class='col-md-12'> <div class='col-md-12'>
<div class="alert alert-primary" role="alert"> <div class="alert alert-primary" role="alert">
Die Noten Anzeige ist noch nicht ganz ausgereift und funktioniert z.Z. noch nicht auf mobilen Geräten. <br> Die Noten Anzeige ist noch nicht ganz ausgereift und funktioniert z.Z. noch nicht auf mobilen Geräten. <br>
Empfohlen wird Google Chrome (Chromium) oder Mozilla Firefox. Empfohlen wird Google Chrome (Chromium) oder Mozilla Firefox auf Windows, macOS oder Linux.
</div> </div>
</div> </div>
<div class='col-md-5'> <div class='col-md-5'>