Getting "File already exists" error

I am successfully able to drag and drop an mp3 file (0.mp3) into the Project Explorer. When I attempt to drag and drop a second file (1.mp3) into the Project Explorer I get an error saying that the file already exists. It’s not in the Project Explorer so where is the reference that is preventing the insertion into the project. If I knew where that was, I could try to delete the reference.

Thanks,
Ken


Is this reproducible? If you close and reopen the project, does it still happen?

Yes, However, I’ve experimented so much now that everything is a mess. I’ll try to set up a simple example and create a screen recording.

I lied. I didn’t take the time to create a simple example, I just went the current one. Anyway, this video (https://youtu.be/yByI7vjv2u8) shows me restarting AppStudio and trying to unsuccessfully copy several mp3 files to the Project Explorer. I’ve attached zip files of the program folder and the folder of mp3 files to this posting.

I don’t know if it’s related, but the one mp3 that I successfully added to the project doesn’t play when testing the program. This video (https://youtu.be/GD3S7Ego7c8) shows me playing the audio file in Media Player then points to where the file is reference in the NSB code and then running the program in Chrome. When I press the green button the audio should play but no sound is produced. Note the warnings that appear in the console window. I’ve also attached a copy of the console log.

Please let me know what I’ve done wrong.

Thanks,
Ken

127.0.0.1-1693433077763.log (1.2 KB)
New folder.zip (133.2 KB)
AAC-GAI demo.appstudio.zip (37.9 KB)

What are the warnings in the Console window?

What does your code to play the sound look like?

Does the PlaySound sample work for you?

The warnings in the console window are these:
appstudioFunctions.js:1008 The AudioContext was not allowed to start. It must be resumed (or created) after a user gesture on the page. Autoplay policy in Chrome - Chrome Developers
(anonymous) @ appstudioFunctions.js:1008
(anonymous) @ appstudioFunctions.js:989
(anonymous) @ __mp3.js:1
DevTools failed to load source map: Could not load content for http://127.0.0.1:56768/AAC_GAI_demo/toolbox/bs4/dist/js/bootstrap.bundle.min.js.map: HTTP error: status code 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE
chrome.js:1004 [INFO ] - [Content::OnInit…] [Tab ID: 1794253874 Frame ID: 1] - Tab Url=http://127.0.0.1:56768/AAC_GAI_demo/
chrome.js:1004 [INFO ] - [Content::OnInit…] [Tab ID: 1794253874 Frame ID: 1] - Frame Url=http://127.0.0.1:56768/AAC_GAI_demo/
DevTools failed to load source map: Could not load content for http://127.0.0.1:56768/AAC_GAI_demo/toolbox/bs4/dist/css/bootstrap.min.css.map: HTTP error: status code 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE
appstudioFunctions.js:2202 [PWA] Registration successful ServiceWorkerRegistration {installing: null, waiting: null, active: ServiceWorker, navigationPreload: NavigationPreloadManager, scope: ‘http://127.0.0.1:56768/AAC_GAI_demo/’, …}

My code to invoke the sound looks like this:

  If i=1 Then
    PlaySound("0.mp3")
  Else If i=2 Then
    PlaySound("0.mp3")
  Else If i=3 Then
    PlaySound("0.mp3")
  Else If i=4 Then
    PlaySound("0.mp3")
  Else If i=0 Then
    PlaySound("0.mp3")
  End If

Yes, the example program runs fine.

Hi, Just sharing my thoughts. Just like my post, which says speak is deprecated. Now, play mp3 without player consent is no longer allowed. U can mute your audio, and let player unmute your audio. This is all stated in your link pointing to chrome new policy. Best rdgs, tst

Playtone should work for the time being…

See the link you provided for a better understanding. Autoplay policy in Chrome - Chrome Developers.

Why do you think that the PlaySound sample works correctly? Both that and my program are running in Chrome… One difference I see is that my program is running from my Microsoft OneDrive folders. I don’t know if that makes it a “virtual” folder and if yes, does NSB/Chrome have trouble with that?

Sorry, I think u misunderstood my post. I am saying playsound only works with some tweaking. Playtone works like retro pc chunking out different tone…

<button id="unmuteButton"></button>

<script>
  unmuteButton.addEventListener('click', function() {
    video.muted = false;
  });
</script>```

Sorry, but I’m just a minimal Basic programmer. Can you suggest what this would look like in Basic format? I tried just replacing “PlaySound” with “PlayTune” and got this error:

Uncaught TypeError: Failed to set the ‘value’ property on ‘AudioParam’: The provided float value is non-finite…
line 954 column 32

Try this in main function, you have to check appstudio documentation for capulazation the ‘java…’ And ‘end java…’

<javascript>
<button id="unmuteButton"></button>

<script>
  unmuteButton.addEventListener('click', function() {
    video.muted = false;
  });
</script>
<end javascript>

I must tell you I am also not expect, you should wait nsbasic team to follow up with you…

Sorry for not checking earlier. I just found the PlayTone example. Unfortunately, I want to play a sound file not just a tone.

I believe I’ve found the root cause of this error.

Start with two sound files. Change the names of the files to be a single digit (e.g., 1.wav and 3.wav).

Create a new project.

Drag one file to the Project Explorer. This will succeed.

Drag second file to the Project Explorer. This will fail with a “File already exists” error.

Change name of second file to have a 2 digit name (e.g., 13.wav).

Drag second file to Project Explorer. This will succeed.

I have no idea what’s happening behind the scenes to cause this failure.

It’s a bug. Thank you for reporting this - an issue has been opened.

In the meantime, use filenames with at least two characters. (probably a good idea to have them be more descriptive anyway).