user1143269
user1143269

Reputation: 51

How to play audio in Cocos2D javascript

Is it right? It doesn't work.

var snd = new Audio('/bgm/1.mp3') //the path is [project dir]/src/resources/bgm/1.mp3
snd.play();

Upvotes: 2

Views: 1523

Answers (1)

Dhivakar
Dhivakar

Reputation: 11

var snd = new Audio('/jah/assets/bgm/1.mp3') //the path is [project dir]/src/resources/bgm/1.mp3 snd.load(); snd.play();

try the above changes it will work in debug mode

Upvotes: 1

Related Questions