Quantcast
Channel: Ionic Forum - Latest posts
Viewing all articles
Browse latest Browse all 228595

How to play local audio files

$
0
0

I'm still stuck on this.

I don't know where to put the audio file. I get no error messages in Chrome Inspect but the audio just does not play.

My code looks like this:

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

$scope.sound_on = false;
var media       = new Media( '/android_asset/www/'+'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" );
    }
}

});


Viewing all articles
Browse latest Browse all 228595

Trending Articles



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