Repeat sound make app crashes

Repeat sound make app crashes

Jordi Ramon Puig的头像

Hello people,

I'm making an app with HTML5 and I've a problem when I try to play sound. The app crashes when I trying to repeat the same sound.

The encapsulator 2.0 can play the same sound multiple times?

The first code I've used it this:

 when load object

  •  var sound = new Audio();
  •  sound.src = "my audio file .wav "

 when hit the object

  •  sound.currentTime = 0;
  •  sound.play();

But doesn't work, only play the sound 1 time.

Now I'm using this other code:

 when load object

  •  var sound = new Audio();

when hit the object

  •  sound.src = "my audio file .wav "
  •  sound.play();

Works sometimes but always causes the app crashes.

Anyone can help me?

Thanks

1 条帖子 / 0 new
如需更全面地了解编译器优化,请参阅优化注意事项