HTML5 - Blueprint generated audio component crash

Create an actor blueprint that generates an audio component and plays some wav file.
Drop the blueprint to your level and make sure it plays the wav file.
Do the same for another level.
There has to be a way to change levels for testing.

Export your project for html5. If you try to change levels, _alDeleteBuffers method generates an exception and game tick crashes.

I’ve extracted the function. The crash occurs in the for-loop of src.queue.length, and thrown error is Uncaught TypeError: Cannot read property ‘length’ of undefined

function _alDeleteBuffers ( count, buffers ) {
  if ( !AL.currentContext ) {
    return
  }
  if ( count > AL.currentContext.buf.length ) {
    AL.currentContext.err = 40963;
    return
  }
  for ( var i = 0; i < count; ++i ) {
    var bufferIdx = HEAP32[ buffers + i * 4 >> 2 ] - 1;
    if ( bufferIdx >= AL.currentContext.buf.length || !AL.currentContext.buf[ bufferIdx ] ) {
      AL.currentContext.err = 40961;
      return
    }
    var buffer = AL.currentContext.buf[ bufferIdx ];
    for ( var srcId in AL.currentContext.src ) {
      var src = AL.currentContext.src[ srcId ];
      if ( !src ) {
        continue
      }

      // ERROR IN HERE...
      for ( var k = 0; k < src.queue.length; k++ ) {
        if ( buffer === src.queue[ k ].buffer ) {
          AL.currentContext.err = 40964;
          return
        }
      }
    }
  }
  for ( var i = 0; i < count; ++i ) {
    var bufferIdx = HEAP32[ buffers + i * 4 >> 2 ] - 1;
    delete AL.currentContext.buf[ bufferIdx ]
  }
}

changing

  if ( !src ) {
    continue
  }

to

  if ( !(typeof  src !== 'undefined' && typeof src.queue !== 'undefined') ) {
    continue
  }

solves the problem, but i do not think this is a good solution :slight_smile:

Hey ,

Could you please write out the exact reproduction steps you were using when you encountered this error? I attempted to recreate what I was seeing and read, but I believe I missed a few steps because I did not run into a crash.

My main goal is to get a bug in, to add in the work around you’ve found and see if there is a better solution that can be included as well.

Thanks! :slight_smile:

hi.

I think this is an emscripten bug then a UE one. I was looking through the emcc repository and found out that [library_openal.js][1] was responsible for the current situation. I’ve also created a bug report in github about this situation.

emscripten/library_openal.js at 07b87426f898d6e9c677db291d9088c839197291 · emscripten-core/emscripten · GitHub

Do you have a test project that you could zip up for download somewhere that reproduces the issue?

Thanks for reporting this. Since you believe this is an emscripten issue, would you like me to further look into this issue on our end?

Thank you!