sinerider icon indicating copy to clipboard operation
sinerider copied to clipboard

Add support for multiple asset types

Open maxwofford opened this issue 2 years ago • 4 comments

As discussed with @grymmy and @karamassie, this is a nice-to-have for after launch, but not required for launch. This is related to https://github.com/hackclub/sinerider/pull/482

This adds support for smartly choosing the asset to import based on browser compatibility. It also includes an example, switching the import string sounds.music.intro: '.mp3' to the array sounds.music.intro: ['.m4a', '.mp3'].

It's still backwards compatible with the previous import file, but now switching imports to an array like that will to through them first to last, check if the file is compatible with the current browser (using howler.js, so we don't have to maintain it) and import the first file that works. It can even be extended to something like sounds.music.intro: ['.webm', '.ogg', '.m4a', '.mp3'] as long as all 4 files are in the assets folder. In this example, we go from most efficient compression (but less supported) formats (.webm) sliding to large filesize but compatible with any browser formats (.mp3).

maxwofford avatar May 04 '23 20:05 maxwofford

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
sinerider ✅ Ready (Inspect) Visit Preview May 8, 2023 9:46pm

vercel[bot] avatar May 04 '23 20:05 vercel[bot]

This sounds like it'd be trivial to complete, except for file conversion- what's the plan there?

camdan-me avatar May 05 '23 16:05 camdan-me

what's the status of this pr? could this make it into main?

JosiasAurel avatar Jun 16 '23 19:06 JosiasAurel

Ah, damn sorry I let this languish. And I just closed two PRs because we don’t have exactly this functionality. Sorry @maxwofford @JosiasAurel 🤦‍♂️

@Captainexpo-1 let’s take a look at completing this, it’d be awesome if we could gracefully fall back from OGG sound files

polytroper avatar Oct 31 '23 16:10 polytroper