Mercurial > hg > webaudioevaluationtool
comparison js/core.js @ 2817:6b38dc641812
Using animation callback for playhead
author | Nicholas Jillings <nicholas.jillings@mail.bcu.ac.uk> |
---|---|
date | Fri, 28 Apr 2017 11:32:28 +0100 |
parents | 74b0a1be28a7 |
children | 25027b8665a2 c3e444d743f1 |
comparison
equal
deleted
inserted
replaced
2815:7f2bb5997114 | 2817:6b38dc641812 |
---|---|
2901 } else { | 2901 } else { |
2902 this.curTimeSpan.textContent = '00:00'; | 2902 this.curTimeSpan.textContent = '00:00'; |
2903 } | 2903 } |
2904 } | 2904 } |
2905 } | 2905 } |
2906 if (this.playbackObject !== undefined && this.interval === undefined) { | |
2907 window.requestAnimationFrame(this.update.bind(this)); | |
2908 } | |
2906 }; | 2909 }; |
2907 | 2910 |
2908 playhead.interval = undefined; | 2911 playhead.interval = undefined; |
2909 | 2912 |
2910 playhead.start = function () { | 2913 playhead.start = function () { |
2911 if (this.playbackObject !== undefined && this.interval === undefined) { | 2914 if (this.playbackObject !== undefined && this.interval === undefined) { |
2912 if (this.maxTime < 60) { | 2915 window.requestAnimationFrame(this.update.bind(this)); |
2913 this.interval = window.setInterval(function () { | |
2914 interfaceContext.playhead.update(); | |
2915 }, 10); | |
2916 } else { | |
2917 this.interval = window.setInterval(function () { | |
2918 interfaceContext.playhead.update(); | |
2919 }, 100); | |
2920 } | |
2921 } | 2916 } |
2922 }; | 2917 }; |
2923 playhead.stop = function () { | 2918 playhead.stop = function () { |
2924 window.clearInterval(this.interval); | 2919 this.timePerPixel = 0; |
2925 this.interval = undefined; | |
2926 this.scrubberHead.style.left = '0px'; | |
2927 if (this.maxTime < 60) { | |
2928 this.curTimeSpan.textContent = '0.00'; | |
2929 } else { | |
2930 this.curTimeSpan.textContent = '00:00'; | |
2931 } | |
2932 }; | 2920 }; |
2933 return playhead; | 2921 return playhead; |
2934 })(); | 2922 })(); |
2935 | 2923 |
2936 this.volume = (function () { | 2924 this.volume = (function () { |