File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,6 @@ function showResponse(response) {
10
10
11
11
function checkInstall ( response ) {
12
12
if ( response . installationStatus == false ) {
13
- alert ( "WEBweb/fishing Installation not found.\nPlease make sure you have WEBweb/fishing installed on Steam!" ) ;
14
13
window . pywebview . api . closeApplication ( ) ;
15
14
} else {
16
15
setTimeout ( ( ) => openWindow ( ) , 1000 ) ;
@@ -46,13 +45,16 @@ function preloadAudio(files) {
46
45
}
47
46
48
47
function playAudio ( url ) {
49
- const audio = preloadedAudio [ url ] ;
48
+ const audio = preloadedAudio [ url ] ; // Get the preloaded audio object
50
49
if ( audio ) {
51
- audio . play ( ) . catch ( error => {
50
+ const audioClone = audio . cloneNode ( ) ; // Clone the preloaded audio element
51
+ audioClone . play ( ) . catch ( error => {
52
52
console . error ( "Error playing audio:" , error ) ;
53
53
} ) ;
54
- audio . addEventListener ( "ended" , ( ) => {
55
- audio . remove ( ) ;
54
+
55
+ // Optional: Clean up the audio element after it finishes playing
56
+ audioClone . addEventListener ( "ended" , ( ) => {
57
+ audioClone . remove ( ) ; // Clean up the cloned audio element
56
58
} ) ;
57
59
} else {
58
60
console . warn ( `Audio file ${ url } is not preloaded.` ) ;
You can’t perform that action at this time.
0 commit comments