javascript - Playing multiple audio files at once in Ionic/ngCordova -
i'm building app in ionic needs able play 2 audio files @ same time.
at first tried use html5 audio capabilities allowed me that. however: on web played 2 sounds concurrently desired when running on android phone 1 audio file gets played.
i looked further , found ngcordova's $cordovamedia. went ahead , used info on ngcordova's website: http://ngcordova.com/docs/plugins/media/ (and included js files)
resulting in following code:
angular.module('starter.controllers', ['ngcordova']) .controller('homectrl', function($scope, $cordovamedia, $ionicloading) { $scope.play = function() { var media = $cordovamedia.newmedia('http://www.tonycuffe.com/mp3/tail%20toddle.mp3'); media.play(); var media2 = $cordovamedia.newmedia('http://www.tonycuffe.com/mp3/saewill.mp3'); media2.play(); console.log(media); console.log(media2); } });
both objects play fine seperate, when played media2 heard.
anyone knows why , if can fix it? i'm surely open alternatives well.
Comments
Post a Comment