Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70429

Media plugin - can't get it working

$
0
0

@SubEffect wrote:

I seem to have had this working in an old version of Ionic but now I've finished updating the rest of this app and gone back to finalise this the sound won't play.

I have an on-off switch for playing a demo sound in the app. Here is the code, with comments and with the commented out part I thought might be causing my problem. It isn't.

.controller('SoundCtrl', function($scope, $timeout){

  $scope.sound_on = false;
  var media = new Media('100bpm.wav');

  $scope.soundPlayer = function(){
console.log("in soundPlayer");
if($scope.sound_on==false){
 $scope.sound_on=true;
media.setVolume('1.0');
media.play();
console.log("sound on");
console.log(media);
/*$timeout(function(){
 $scope.sound_on=false;
 console.log("should change");
}, 12600);*/
}else{
media.stop();
$scope.sound_on=false;
console.log("sound off");
}
  }
})

I get all the right console logs, and as you can see I've resorted to putting the wav file in the same folder as my js scripts.

Still nothing.

Any help?

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 70429

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>