# \[HTML5 System\_Create\] \[ERR\] assert: assertion: ‘mCrit\[crit\]’ failed

**URL:** https://qa.fmod.com/t/html5-system-create-err-assert-assertion-mcrit-crit-failed/15107
**Category:** FMOD Engine
**Created:** [October 5, 2019, 6:28pm UTC](https://qa.fmod.com/t/html5-system-create-err-assert-assertion-mcrit-crit-failed/15107 "2019-10-05T18:28:58Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![Janick](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/janick/32/715_2.png) [@Janick](https://qa.fmod.com/u/Janick)
#### Post date: [October 5, 2019, 6:28pm UTC](https://qa.fmod.com/t/html5-system-create-err-assert-assertion-mcrit-crit-failed/15107/1 "2019-10-05T18:28:58Z")

</div>

Hello everyone,

I’m new to FMOD and I’m trying to use the HTML5 Javascript version of the API but I’m getting this error as soon as I call FMOD.System\_Create:

 ![[ERR] assert: assertion: 'mCrit[crit]' failed](https://canada1.discourse-cdn.com/flex036/uploads/fmod/original/1X/fc37d7a5a722cac3f03203cd7142f757e24ca132.png)

I’ve tried on Chrome (Version 77.0.3865.90 (Official Build) (64-bit)) and Safari (Version 13.0.1) on Mac.

I’m basically trying to play a sound in the browser.

Any ideas?

Here’s my code:

```
function main () {
  var result
  var outval = {}
  
  result = FMOD.System_Create(outval)
  
  if (result !== FMOD.OK) {
    console.log('result:', result)
  }
}

var FMOD = {}; // FMOD global object which must be declared to enable 'main' and 'preRun' and then call the constructor function.
FMOD['onRuntimeInitialized'] = main; // Called when the Emscripten runtime has initialized
FMOD['TOTAL_MEMORY'] = 64 * 1024 * 1024; // (ASM.JS ONLY) FMOD Heap defaults to 16mb which is enough for this demo, but set it differently here for demonstration (64mb)
FMODModule(FMOD); // Calling the constructor function with our object

```

Thank you very much!!

---

<div class="post-metadata">

### Author: ![brett](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/brett/32/261_2.png) [@brett](https://qa.fmod.com/u/brett)
#### Post date: [October 6, 2019, 9:46pm UTC](https://qa.fmod.com/t/html5-system-create-err-assert-assertion-mcrit-crit-failed/15107/2 "2019-10-06T21:46:15Z")

</div>

you can ignore that. it is from the logging version and not actually asserting. its due to the no thread / cross platform port of the code. I can look into ifdeffing out that assert.

Use the non ‘L’ version by the way for better performance.

---

<div class="post-metadata">

### Author: ![Janick](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/janick/32/715_2.png) [@Janick](https://qa.fmod.com/u/Janick)
#### Post date: [October 14, 2019, 12:38pm UTC](https://qa.fmod.com/t/html5-system-create-err-assert-assertion-mcrit-crit-failed/15107/3 "2019-10-14T12:38:07Z")

</div>

Hello Brett,

Sorry for my late reply, I was away last week.

I’ve tried to ignore the assert, but still no sound is playing. I had a warning saying:

```
warning: browser could not fully decode audio /ocean.wav, trying slower base64 approach

```

So I’ve encoded the file in m4a, now the warning disappeared but it seems like FMOD is having a hard time using it, because when I call System.createSound, it doesn’t give me a valid Sound object, in fact it’s giving me an undefined object.

 ![34](https://canada1.discourse-cdn.com/flex036/uploads/fmod/original/1X/4b635e92e0c5510a703fab74265d0f4f51ccfd94.png)

Do you see something obvious I could’ve missed?

Here’s the full code:

```
function prerun () {
  FMOD.FS_createPreloadedFile(
    '/',
    'ocean.m4a',
    'sounds/',
    true,
    false,
  )
}

function main () {
  var result
  var outval = {}

  result = FMOD.System_Create(outval)

  if (result !== FMOD.OK) {
    console.log('result:', result)
  }

  var System = outval.val
  var outval2 = {}
  System.createSound('/sounds/ocean.m4a', FMOD.LOOP_OFF, null, outval2)
  var Ocean = outval2.val
  console.log('result:', Ocean)
  System.playSound(Ocean, null, false, null)
}

var FMOD = {}; // FMOD global object which must be declared to enable 'main' and 'preRun' and then call the constructor function.
FMOD['preRun'] = prerun; // Will be called because FMOD runs, but after the Emscripten runtime has initialized
FMOD['onRuntimeInitialized'] = main; // Called when the Emscripten runtime has initialized
FMOD['TOTAL_MEMORY'] = 64 * 1024 * 1024; // (ASM.JS ONLY) FMOD Heap defaults to 16mb which is enough for this demo, but set it differently here for demonstration (64mb)
FMODModule(FMOD); // Calling the constructor function with our object

```

Many thanks!

---

<div class="post-metadata">

### Author: ![brett](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/brett/32/261_2.png) [@brett](https://qa.fmod.com/u/brett)
#### Post date: [October 15, 2019, 12:11am UTC](https://qa.fmod.com/t/html5-system-create-err-assert-assertion-mcrit-crit-failed/15107/4 "2019-10-15T00:11:51Z")

</div>

i think the url part of your createPreloadedFile is wrong  
It is supposed to equal folder + filename

check some of the supplied examples first if you cant get basic sound loading to work.

fmod does not support .m4a by the way, but you would see createsound return FMOD.ERR\_FORMAT for that. You can see the supported format list at [https://www.fmod.com/resources/documentation-api?version=2.0&page=core-api-sound.html#fmod\_sound\_type](https://www.fmod.com/resources/documentation-api?version=2.0&page=core-api-sound.html#fmod_sound_type)

---

<div class="post-metadata">

### Author: ![Janick](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/janick/32/715_2.png) [@Janick](https://qa.fmod.com/u/Janick)
#### Post date: [October 15, 2019, 11:33am UTC](https://qa.fmod.com/t/html5-system-create-err-assert-assertion-mcrit-crit-failed/15107/5 "2019-10-15T11:33:20Z")

</div>

Hello Brett,

I’m sorry I didn’t see the examples.

Thank you very much!

---

<div class="post-metadata">

### Author: ![dZbear](https://avatars.discourse-cdn.com/v4/letter/d/50afbb/32.png) [@dZbear](https://qa.fmod.com/u/dZbear)
#### Post date: [October 15, 2019, 8:54pm UTC](https://qa.fmod.com/t/html5-system-create-err-assert-assertion-mcrit-crit-failed/15107/6 "2019-10-15T20:54:42Z")

</div>

Hi Brett, I’m having the same issue as Janick, but I’m trying to play a sound from an https source and the examples don’t provide any example for this. Issue is happening when I’m calling System.createStream :

```
let soundOut: any = {};
result = system.createStream('https://cdn2.ipnoscloud.com/streams/web/test.mp3', FMOD.LOOP_NORMAL, null, soundOut);

```

which results in this output from fmodL.js :

```
[LOG] SystemI::createSoundInternal : Create name='https://cdn2.ipnoscloud.com/streams/web/test.mp3', mode=0x00000082

fmod.service.ts:13 fmod error: A command issued was not supported by this object. Possibly a plugin without certain callbacks specified. code 68

```

Thanks for any help!

---

<div class="post-metadata">

### Author: ![brett](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/brett/32/261_2.png) [@brett](https://qa.fmod.com/u/brett)
#### Post date: [October 15, 2019, 9:29pm UTC](https://qa.fmod.com/t/html5-system-create-err-assert-assertion-mcrit-crit-failed/15107/7 "2019-10-15T21:29:25Z")

</div>

you cannot use http streaming on this platform

---

<div class="post-metadata">

### Author: ![dZbear](https://avatars.discourse-cdn.com/v4/letter/d/50afbb/32.png) [@dZbear](https://qa.fmod.com/u/dZbear)
#### Post date: [October 16, 2019, 1:24pm UTC](https://qa.fmod.com/t/html5-system-create-err-assert-assertion-mcrit-crit-failed/15107/8 "2019-10-16T13:24:31Z")

</div>

Ok thanks for letting me know, out of curiosity, is it due to the lack of threading?

---

<div class="post-metadata">

### Author: ![brett](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/brett/32/261_2.png) [@brett](https://qa.fmod.com/u/brett)
#### Post date: [October 16, 2019, 11:17pm UTC](https://qa.fmod.com/t/html5-system-create-err-assert-assertion-mcrit-crit-failed/15107/9 "2019-10-16T23:17:34Z")

</div>

when the port was done access to sockets werent really available, but it looks like they have been added recently. If it blocks due to no threads, then yes that would be pretty bad. It wraps websockets by the look of it , we’d have to do some testing on this side to see how well it works.
