48 lines
1.2 KiB
JavaScript
48 lines
1.2 KiB
JavaScript
angular.module('kinderspiel.services', [])
|
|
|
|
.factory("backgroundsounds_mediahandler", function($ionicPlatform, $cordovaMedia) {
|
|
|
|
/*
|
|
* Checkvariable ob App im Hintergrund ist
|
|
*/
|
|
var inbackground=false;
|
|
|
|
/*
|
|
* Soundfiles Variablen
|
|
*/
|
|
var backgroundmusic='';
|
|
$ionicPlatform.ready(function() {
|
|
var mybackground_music = new Media('/android_asset/www/sounds/background/backgound4.mid', loopbackgroundmusic ,null);
|
|
backgroundmusic=mybackground_music;
|
|
});
|
|
|
|
|
|
function loopbackgroundmusic(){
|
|
if (inbackground == false){
|
|
//backgroundmusic.release();
|
|
//backgroundmusic=mybackground_music;
|
|
backgroundmusic.play();
|
|
backgroundmusic.setVolume('0.3');
|
|
}
|
|
}
|
|
|
|
|
|
return {
|
|
playbackgroundmusic: function() {
|
|
if (inbackground == false){
|
|
backgroundmusic.play();
|
|
backgroundmusic.setVolume('0.3');
|
|
}
|
|
},
|
|
stopbackgroundmusic: function() {
|
|
backgroundmusic.stop();
|
|
},
|
|
setbackgroundstate: function(mybool) {
|
|
inbackground=mybool;
|
|
},
|
|
getbackgroundstate: function() {
|
|
return inbackground;
|
|
}
|
|
};
|
|
});
|