Skip to content

Commit

Permalink
add: support for .mp3/.wav/.ogg files
Browse files Browse the repository at this point in the history
  • Loading branch information
nicoecheza committed Oct 4, 2023
1 parent 24f5ad9 commit 8dbb6fc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ const ONE_MB_IN_BYTES = 1_048_576
const ONE_GB_IN_BYTES = ONE_MB_IN_BYTES * 1024
const ACCEPTED_FILE_TYPES = {
'model/gltf-binary': ['.gltf', '.glb'],
'image/png': ['.png']
'image/png': ['.png'],
'audio/mpeg': ['.mp3'],
'audio/wav': ['.wav'],
'audio/ogg': ['.ogg']
}

interface PropTypes {
Expand Down Expand Up @@ -74,6 +77,9 @@ async function validateAsset(extension: string, data: ArrayBuffer): Promise<Vali
// add validators for .png/.ktx2?
case 'png':
case 'ktx2':
case 'mp3':
case '.wav':
case '.ogg':
return null
default:
return `Invalid asset format ".${extension}"`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export const DIRECTORY = {
SCENE: 'scene'
}

export const EXTENSIONS = ['.glb', '.png', '.composite', '.composite.bin', '.gltf', '.jpg', '.png']
export const EXTENSIONS = ['.glb', '.png', '.composite', '.composite.bin', '.gltf', '.jpg']

export function withAssetDir(filePath: string = '') {
return filePath ? `${DIRECTORY.ASSETS}/${filePath}` : DIRECTORY.ASSETS
Expand Down

0 comments on commit 8dbb6fc

Please sign in to comment.