Different path to resources

When exporting with 'organized assets' you get this:

Schermafbeelding 2020-10-22 om 10.28.47

Exporting with 'hype resources':

Xcode and simulator cannot read the 'organized assets' export, resulting in no sound.

I know the solution of course, but it's a bit strange I think.

organized assets should export your mp3 to the folder 'media' ...

example for custom audio regarding 'organized assets':

	  var mp3 = document.createElement("AUDIO");


  mp3.setAttribute("controls", "controls");

Thanks for your answer, but I wasn't clear enough I think.
The mp3's are in the media folder, no problem there.
In the headHTML in Xcode there are different paths. The ./scaleC.mp3 resulting in no sound.
Why is there a difference in export results?

What do you actually have in the javascript code in Hype ?.

Schermafbeelding 2020-10-22 om 11.47.43

Well that would likely be the problem.

The path needs to be as @h_classen suggests

But I can't change it I think. I need the the Wad.js library.

just change it to 'media/your.mp3'

1 Like

The path needs to be "./media/foo.mp3" for the asset export.
You could try some sort of test to see which you need

something along the lines of

    	 var mp3 = document.createElement("AUDIO");
    	function doesFileExist(urlToFile)
        var xhr = new XMLHttpRequest();
        xhr.open('HEAD', urlToFile, false);

        if (xhr.status == "404") {
            console.log("File doesn't exist");
        } else {
            console.log("File exists");


  mp3.setAttribute("controls", "controls");

but lees crude.. :wink:

1 Like

Can't you just hardwire for the expected path set by the export script organized assets meaning the /media folder (as @h_classen suggested) and do the preview with the export script (setting the checkmark on the export script in the preview dropdown)? That way you stay in only one lane.


Good point.

I think the URL needs to be

"./media/foo.mp3" rather than "/media/foo.mp3"

1 Like

That seems to work. I now have this in my headHTML:

const scaleC = new Wad({
source: "./media/scaleC.mp3",

Thank you @MarkHunte for pointing to the .


Just remember that the export script Preview pref, saves with the Hype document when closed. :wink:

Yes I remember that. :grinning:
But I cheered too soon. When exporting it only plays the top file in the headHTML( I have a lot, all tone scales)
Other files won't play. :disappointed_relieved:

when using the exportscript 'organized assets' the Hype-Variable '$/resourcesFolderName/' will not be resolved. That's the thing. So it can not be used under those circumstances. Instead the path has to point to the media-folder. Just in case this has not been clear ...

I understand that, but all the files are preceded with ./media/xx.mp3 and only the first file is recognized.

Schermafbeelding 2020-10-22 om 14.22.10

those paths differ ... if the first one works, that's the right one :slight_smile:

Now I'm losing my path.
That means I can't have different mp3's in the same folder?

no, your notation is just not correct/the same! have a closer look at your screenshot above :slight_smile:

you've used './media' and '.media' it's just mixed ...


It’s always the same.
Someone else needs to see that.
Thank you Hans