I am trying to create a musical instrument consisting of eight notes, these notes are represented by an image divided into eight areas. Whenever I press area plays a note, if I press repeatedly several areas after a while the app stops producing sounds. How can I avoid that happening?
Now I post some code… I working with Ionic Framework.
in app.js
angular.module('starter', ['ionic', 'ngCordova', 'starter.controllers'])
and so on… but the interested part of app.js is the callback of ‘ngCordova’ into angular.module
now on controllers.js
`
angular.module('starter.controllers', [])
.controller('SoundCtrl', function($scope, $cordovaMedia) {
//Play a media
$scope.play = function(src) {
var media = new Media(src, null, null);
$cordovaMedia.play(media);
};
})
`
finally on my file html I do this
`
<img src="img/image.png" style="margin-top:10%;width:100%;height:auto;" usemap="#hangdrum">
<map name="hangdrum">
<area shape="circle" coords="298,63,37,34" ng-click="play('/android_asset/www/mp3/A.mp3')">
`
now… the sound is ok and it start correctly but if I play this sound (or press this different times after 10 time (more or less) it stop to play sound.
Why? How can I fix it? Thanks to all