Commit 15adbdce authored by marioromera's avatar marioromera
Browse files

try window sound

parent e313f84f
......@@ -10,10 +10,22 @@
<script src="./soundmanager2-jsmin.js"></script>
<script>
soundManager.setup({
window.soundManager = soundManager.setup({
url: './swf/',
debugMode: true,
onready: function () {
window.yourTurnAudio = soundManager.createSound({
id: 'yourTurnAudio',
url: './yourTurn.mp3',
});
},
});
document.querySelector('.app').addEventListener('click', playSound, false);
function playSound(e) {
window.yourTurnAudio.play({ loops: 3, volume: 0 });
}
</script>
</head>
......
......@@ -82,7 +82,9 @@ export default function Drawing(svgId) {
if (myTurn) {
// AUDIO
soundManager.setVolume('yourTurnAudio', 50);
if (window.yourTurnAudio) {
window.yourTurnAudio.setVolume('yourTurnAudio', 50);
}
letterCoords.forEach((letter) => {
const bg = this.myTurnG
......@@ -104,8 +106,7 @@ export default function Drawing(svgId) {
});
} else {
console.log('Finishing turn');
soundManager.setVolume('yourTurnAudio', 0);
if (window.yourTurnAudio) window.yourTurnAudio.setVolume(0);
this.myTurnG.selectAll('path').remove();
}
});
......
......@@ -18,20 +18,6 @@ import _ from 'lodash';
import Drawing from './components/drawing';
const draw = new Drawing('#drawing-svg');
import yourturnfile from '../assets/yourturn.ogg';
import { soundManager } from 'soundmanager2';
document.querySelector('.app').addEventListener('click', playSound, false);
const yourTurnAudio = soundManager.createSound({
id: 'yourTurnAudio',
url: './yourTurn.mp3',
});
function playSound(e) {
yourTurnAudio.play({ loops: 3, volume: 0 });
}
const idContainer = document
.querySelector('.id-container')
.getBoundingClientRect().height;
......
Supports Markdown
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