Error when Playing Audio From ASD

I’m building an app to play sound from ASD. When checked using FileTool the result is True. But when playing, an error notification appears.

“703: Unable to Play Files”

Any solution? I’ve tried using file:///, without file:///, Full path, but the result is the same.

This Sound component is best for short sound files, such as sound effects, while the Player component is more efficient for longer sounds, such as songs.

You might get an error if you attempt to play a sound immediately after setting the source.

before I used this component there was no problem, the problem arose after the ASD method

Where did the file come from and how did it get to the directory ASD?
If you have it, it is assets, I think it is not necessary to specify the full path, just put the name of the mp3 file

sound files are not from assets, sounds come from downloaded files then stored in ASD (/storage/emulated/0/android/data/apk name/files/dummy.mp3).

I was in a similar mess with the download and I simply put it as seen in the image, without // or file://
maybe it will work

image

Thank you, but I have tried that methode with same error

1 Like

what happens if you use the player component?
in case it does not work, show us an updated screenshot of your relevant blocks including Do it result of the path to the sound to play
Taifun

Welcome back to the community :pray:t2:

@sadid_al_Mannan can you please provide a minimal project to reproduce the issue? I’m not able to replicate it, so I believe I may be missing something.

Here you go:
Sound_ASD.aia (142.7 KB)

Summary

Btw, there is a way to play the sound component from the ASD as well. Let’s see if anyone finds out? :slightly_smiling_face:

According to your blocks it does not work for the full path… so my guess is, it works with the absolute path, i.e without the leading file://
Welcome back @bodymindpower !

Taifun

No, unfortunately not with that either…

grafik

To give a quick update on this issue: I’ve traced down the issue, and it’s not really related with the Sound component, but the MediaUtil helper. We’ve modified it and there is one kind of MediaSource which are not handled (that’s why the Sound component raises the error).

I didn’t really test all source types, but my guess is that by tricking the MediaUtil to think the source is a different one, it forces it to fall into a handled one.


As mentioned in this comment, this bug will be fixed in Kodular sources. Despite that PR introduces a few new blocks to App Inventor sources from Kodular, the bug is not present in those changes.

As I said earlier in the AI2 forum, this bug does not exist with AI2.
All paths work there:

  1. file:///storage/emulated/0/Android/data/io.makeroid.companion/files/Music-1_.mp
  2. /storage/emulated/0/Android/data/io.makeroid.companion/files/Music-1_.mp
  3. file:///sdcard/Android/data/edu.mit.appinventor.aicompanion3/files/Music-1_.mp3
  4. /sdcard/Android/data/edu.mit.appinventor.aicompanion3/files/Music-1_.mp3

Welcome back @bodymindpower to the community :slightly_smiling_face:

Yeah, I just confirmed that from an SDCard path it works. I’ll be publishing a fix today for the component.

The mistake was that we were detecting the input files as EXTERNAL rather than SDCARD (without file:) or FILE_URL (with file:).

Please, use this extension instead of the native Sound component:

com.google.appinventor.components.runtime.SoundFixed.aix (2.7 MB)

This extension is exactly the Sound component (it will even appear in the Media category), but with the mentioned bugfix. The bugfix will be included in the next release, but in the meantime, you may want to use the extension as a temporary solution.

Attaching a demo AIA to show it’s working (thanks @bodymindpower for the help):
Sound_ASD (1).aia (2.8 MB)