File tree Expand file tree Collapse file tree 2 files changed +12
-3
lines changed
client/src/library/player Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -149,11 +149,18 @@ class PlayerUI {
149
149
this . player . play ( { whichSound : 'last' } ) ;
150
150
}
151
151
152
- if ( $button . id === 'js-byId' ) {
152
+ if ( $button . id . substring ( 0 , 7 ) === 'js-byId' ) {
153
153
const songId = $button . getAttribute ( 'data-song-id' ) ;
154
154
this . player . play ( { whichSound : parseInt ( songId ) } ) ;
155
155
}
156
156
157
+ if ( $button . id === 'pause' ) {
158
+ this . player . pause ( ) ;
159
+ }
160
+
161
+ if ( $button . id === 'stop' ) {
162
+ this . player . stop ( ) ;
163
+ }
157
164
}
158
165
159
166
protected _setPlayingProgress ( percentage : number ) : void {
Original file line number Diff line number Diff line change @@ -60,9 +60,11 @@ <h1>web audio api player - simple example</h1>
60
60
< section id ="js-extra-buttons ">
61
61
< button id ="js-first " class ="button "> First</ button >
62
62
< button id ="js-last " class ="button "> Last</ button >
63
- < button id ="js-byId " class ="button " data-song-id ="1314412 "> Song by ID: 1314412 (= 1st song in queue)</ button >
64
- < button id ="js-byId " class ="button " data-song-id ="1214935 "> Song by ID: 1214935 (= 2nd / last song in
63
+ < button id ="js-byId-1 " class ="button " data-song-id ="1314412 "> Song by ID: 1314412 (= 1st song in queue)</ button >
64
+ < button id ="js-byId-2 " class ="button " data-song-id ="1214935 "> Song by ID: 1214935 (= 2nd / last song in
65
65
queue)</ button >
66
+ < button id ="pause " class ="button "> Pause</ button >
67
+ < button id ="stop " class ="button "> Stop</ button >
66
68
</ section >
67
69
68
70
</ body >
You can’t perform that action at this time.
0 commit comments