angularjs - Unable to play sound through Phonegap Android Build -
i having app build cordova , angular js. trying play sound when new event occurs , trying achieve creating append of tag within new event function , calling #mysound.play(). when test on desktop browser there working on every new event can hear sound playing on other hand when create it's apk through phonegap , test on samsung galaxy there isn't playing sound on new event. kindly let me know if missing or better way achieve goal?
function displayevents(data,div_id) { var icon_trans_type=''; var icons=''; var icons2=''; var htm=''; $.each( data, function( key, val ) { var new_tag=''; if (val.viewed==1){ $('<audio id="chataudio"><source src="locales/android/raw/notify.mp3" type="audio/mp3"></audio>').appendto('body'); $('#chataudio')[0].play(); new_tag='<div class="new-tag rounded" id="new-event">'+ gettrans('new','new') +'</div>'; } }); //createelement('new-events',htm); createelement(div_id,htm); }
the play method provided html5 api useful playing media files available on web. cordova provides media plugin play local media files in device.
cordova media plugin should trick supported in various mobile platforms android, ios, windows, blackberry etc.