A
A
Alexey2016-11-29 18:35:29
Apache Cordova
Alexey, 2016-11-29 18:35:29

Audio in Ionic Framework 1, HTML5 audio 2-3 sounds at the same time, is it possible?

Need to implement music and effects in Ionic.
I tried to implement it using Cordova Media, but I refused because this solution worked very unstable.
I settled on HTML5 Audio.
This solution works on a real device but loses one by one, that is, if one file is playing, the other simply interrupts it and starts playing.
Tell me how to play 2-3 sound files at the same time?
Function to play:

function loadMedia(src, onError, onStatus, onStop) {
            var defer = $q.defer();

            if (service.active) {
                $ionicPlatform.ready(function() {
                    if ($ionicPlatform.is('android')) {
                        src = '/android_asset/www/' + src;
                    }

                    defer.resolve(new Audio(src));
                });
            }

            return defer.promise;
        }

Call from controller:
MediaSrv.loadMedia('audio/bottomnumber.mp3').then(function(media){
                                media.play();
                            });

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question