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 {
8
8
9
9
this . exportButton . addEventListener ( 'click' , this . exportWavFile )
10
10
this . playButton . addEventListener ( 'click' , this . play )
11
+ this . pauseButton . addEventListener ( 'click' , this . pause )
11
12
12
13
document . addEventListener ( 'keydown' , this . onKeydown . bind ( this ) )
13
14
this . morphaweb . wavesurfer . on ( 'seek' , this . onSeek . bind ( this ) )
@@ -30,12 +31,24 @@ export default class ControlsHandler {
30
31
}
31
32
32
33
play = ( ) => {
33
- if ( this . morphaweb . wavesurfer . isPlaying ) {
34
+ if ( this . morphaweb . wavesurfer . isPlaying ( ) ) {
34
35
this . morphaweb . wavesurfer . seekTo ( 0 )
35
36
}
36
37
this . morphaweb . wavesurfer . play ( )
37
38
}
38
39
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
+
39
52
onSeek = ( p ) => {
40
53
this . morphaweb . playOffset = p
41
54
this . morphaweb . markerHandler . removeTopMarker ( "top" )
@@ -62,6 +75,9 @@ export default class ControlsHandler {
62
75
case "k" :
63
76
this . morphaweb . markerHandler . removeSelectedMarker ( )
64
77
break ;
78
+ case " " :
79
+ this . playToggle ( )
80
+ break ;
65
81
}
66
82
}
67
83
Original file line number Diff line number Diff line change 22
22
< section >
23
23
< section >
24
24
< button id ="play "> play</ button >
25
- < button id ="pause " class =" grey " > pause</ button >
25
+ < button id ="pause "> pause</ button >
26
26
< button id ="export " class ="button ">
27
27
< div class ="text-2xl "> export reel</ div >
28
28
< div class ="text-xs "> (stereo, 32-bit, 48KHz)</ div >
@@ -51,6 +51,12 @@ <h3>SHORTCUTS</h3>
51
51
</ div >
52
52
< div > remove selected marker</ div >
53
53
</ section >
54
+ < section class ="shortcut ">
55
+ < div class ="shortcut-icon ">
56
+ < div > ␣</ div >
57
+ </ div >
58
+ < div > play/pause</ div >
59
+ </ section >
54
60
</ section >
55
61
</ section >
56
62
< 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