Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OGGs not obtainable in HTML5 even when converted to MP3 #1215

Open
pkhead opened this issue May 26, 2024 · 1 comment
Open

OGGs not obtainable in HTML5 even when converted to MP3 #1215

pkhead opened this issue May 26, 2024 · 1 comment

Comments

@pkhead
Copy link

pkhead commented May 26, 2024

I wrote a custom converter to convert ogg files to mp3, since oggs are not natively supported on HTML5. However, whenever I build the project for HTML5, the resources are not obtainable even though they should have been converted to mp3 files. This is fixed by including the stb_ogg_sound library, in which case the sound files will be obtainable and be converted to mp3 files, but it's a little inconvenient that I have to include that library even though in the end there should be no ogg file processing.

This is the code for my converter:

package convert;

class ConvertOgg2Mp3 extends hxd.fs.Convert {
    function new() {
        super("ogg", "mp3");
    }

    override function convert() {
        var cmd = "ffmpeg";
        var args = ["-hide_banner", "-loglevel", "error", "-i", srcPath, "-ar", "44100", dstPath];
        command(cmd, args);
    }

    // register the convert so that it can be found
    static var _ = hxd.fs.Convert.register(new ConvertOgg2Mp3());

    // used for macro compilation
    public static function doNothing() {}
}

And this is my build.hxml

-cp src
-cp heaps-aseprite/src
-lib heaps
-lib deepnightLibs
-lib ldtk-haxe-api
-lib ase
--main Boot
--debug
-D windowTitle=TEETOEGAME
-D windowSize=1280x720

--macro aseprite.Macros.init()

# Web target
--macro convert.ConvertOgg2Mp3.doNothing()
--macro convert.ConvertWav2Mp3.doNothing()
--js bin/js/game.js
-lib stb_ogg_sound
@MSGhero
Copy link
Contributor

MSGhero commented May 26, 2024

OGGs are straight up ignored on HTML5 without stb, and it's intentional. #1152 is slightly related

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants