Skip to content

Commit c7e933c

Browse files
joshlamzmxv
authored andcommitted
Update usage example (#539)
Makes more clear that the call to `play` is done within the initialization callback, i.e. the sound player must be loaded first before `play` will work.
1 parent e59e693 commit c7e933c

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Playback completion callback | ✓ | ✓ | ✓
1616
Pause | ✓ | ✓ | ✓
1717
Resume | ✓ | ✓ | ✓
1818
Stop | ✓ | ✓ | ✓
19-
Reset | | ✓ |
19+
Reset | | ✓ |
2020
Release resource | ✓ | ✓ | ✓
2121
Get duration | ✓ | ✓ | ✓
2222
Get number of channels | ✓ | |
@@ -84,15 +84,15 @@ var whoosh = new Sound('whoosh.mp3', Sound.MAIN_BUNDLE, (error) => {
8484
}
8585
// loaded successfully
8686
console.log('duration in seconds: ' + whoosh.getDuration() + 'number of channels: ' + whoosh.getNumberOfChannels());
87-
87+
8888
// Play the sound with an onEnd callback
89-
whoosh.play((success) => {
90-
if (success) {
91-
console.log('successfully finished playing');
92-
} else {
93-
console.log('playback failed due to audio decoding errors');
94-
}
95-
});
89+
whoosh.play((success) => {
90+
if (success) {
91+
console.log('successfully finished playing');
92+
} else {
93+
console.log('playback failed due to audio decoding errors');
94+
}
95+
});
9696
});
9797

9898
// Reduce the volume by half

0 commit comments

Comments
 (0)