Commit 3b899097 authored by Ilya Prokhorov's avatar Ilya Prokhorov

Stop music

parent 728083ab
......@@ -46,9 +46,9 @@ void Music::play() {
var audioPath = UTF8ToString($0);
audioPath += ".mp3";
var audio = new Audio(audioPath);
audio.loop = true;
audio.play();
FlameSteelBattleHorn_music_global = new Audio(audioPath);
FlameSteelBattleHorn_music_global.loop = true;
FlameSteelBattleHorn_music_global.play();
}, path->c_str());
}
......@@ -60,6 +60,26 @@ void Music::play() {
void Music::stop() {
#ifndef __EMSCRIPTEN__
#else
if (path.get() != nullptr) {
//cout << "play sound through javascript" << endl;
EM_ASM({
if (FlameSteelBattleHorn_music_global != null) {
FlameSteelBattleHorn_music_global.pause();
}
});
}
else {
//cout << "can't play sound - path is null" << endl;
}
#endif
}
Music::~Music() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment