File tree Expand file tree Collapse file tree 2 files changed +24
-2
lines changed
Expand file tree Collapse file tree 2 files changed +24
-2
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ export default class ControlsHandler {
88
99 this . exportButton . addEventListener ( 'click' , this . exportWavFile )
1010 this . playButton . addEventListener ( 'click' , this . play )
11+ this . pauseButton . addEventListener ( 'click' , this . pause )
1112
1213 document . addEventListener ( 'keydown' , this . onKeydown . bind ( this ) )
1314 this . morphaweb . wavesurfer . on ( 'seek' , this . onSeek . bind ( this ) )
@@ -30,12 +31,24 @@ export default class ControlsHandler {
3031 }
3132
3233 play = ( ) => {
33- if ( this . morphaweb . wavesurfer . isPlaying ) {
34+ if ( this . morphaweb . wavesurfer . isPlaying ( ) ) {
3435 this . morphaweb . wavesurfer . seekTo ( 0 )
3536 }
3637 this . morphaweb . wavesurfer . play ( )
3738 }
3839
40+ pause = ( ) => {
41+ this . morphaweb . wavesurfer . pause ( )
42+ }
43+
44+ playToggle = ( ) => {
45+ if ( this . morphaweb . wavesurfer . isPlaying ( ) ) {
46+ this . morphaweb . wavesurfer . pause ( )
47+ } else {
48+ this . morphaweb . wavesurfer . play ( )
49+ }
50+ }
51+
3952 onSeek = ( p ) => {
4053 this . morphaweb . playOffset = p
4154 this . morphaweb . markerHandler . removeTopMarker ( "top" )
@@ -62,6 +75,9 @@ export default class ControlsHandler {
6275 case "k" :
6376 this . morphaweb . markerHandler . removeSelectedMarker ( )
6477 break ;
78+ case " " :
79+ this . playToggle ( )
80+ break ;
6581 }
6682 }
6783
Original file line number Diff line number Diff line change 2222 < section >
2323 < section >
2424 < button id ="play "> play</ button >
25- < button id ="pause " class =" grey " > pause</ button >
25+ < button id ="pause "> pause</ button >
2626 < button id ="export " class ="button ">
2727 < div class ="text-2xl "> export reel</ div >
2828 < div class ="text-xs "> (stereo, 32-bit, 48KHz)</ div >
@@ -51,6 +51,12 @@ <h3>SHORTCUTS</h3>
5151 </ div >
5252 < div > remove selected marker</ div >
5353 </ section >
54+ < section class ="shortcut ">
55+ < div class ="shortcut-icon ">
56+ < div > ␣</ div >
57+ </ div >
58+ < div > play/pause</ div >
59+ </ section >
5460 </ section >
5561 </ section >
5662 < section class ="footer "> this is an < a href ="https://github.com/knandersen/morphaweb " target ="_blank "> open source
You can’t perform that action at this time.
0 commit comments