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 {
149149 this . player . play ( { whichSound : 'last' } ) ;
150150 }
151151
152- if ( $button . id === 'js-byId' ) {
152+ if ( $button . id . substring ( 0 , 7 ) === 'js-byId' ) {
153153 const songId = $button . getAttribute ( 'data-song-id' ) ;
154154 this . player . play ( { whichSound : parseInt ( songId ) } ) ;
155155 }
156156
157+ if ( $button . id === 'pause' ) {
158+ this . player . pause ( ) ;
159+ }
160+
161+ if ( $button . id === 'stop' ) {
162+ this . player . stop ( ) ;
163+ }
157164 }
158165
159166 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>
6060 < section id ="js-extra-buttons ">
6161 < button id ="js-first " class ="button "> First</ button >
6262 < 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
6565 queue)</ button >
66+ < button id ="pause " class ="button "> Pause</ button >
67+ < button id ="stop " class ="button "> Stop</ button >
6668 </ section >
6769
6870</ body >
You can’t perform that action at this time.
0 commit comments