android - Webview play music trough javascript -
my javascript code works chrome , other browers. in android webview music don't work? first used .wav musicformat. changed .mp3 musicformat. don't worked audio-files located under assets
my js script
var patharena = "assets/assets cr/"; var nameoftheunit; /*********************************************hide_stuff********************************************/ var hidestuff = function () { $('.arena0, .arena1, .arena2, .arena3, .arena4, .arena5, .arena6, .arena7, .arena8,.arena9, .arena10, .arena11').hide(); }; /*********************************************choose_arena********************************************/ var arenachoose = function () { var arenachoice = $(this).data('val'); switch (arenachoice){ case "arena0": if($(this).data('worth')){ $('.arena0').show(); $('.choosearena').hide(); patharena += "arena%200%20(training%20camp)/"; } break; case "arena1": if($(this).data('worth')){ $('.arena1').show(); $('.choosearena').hide(); patharena += "arena_1_goblin_stadium/"; } break; case "arena2": if($(this).data('worth')){ $('.arena2').show(); $('.choosearena').hide(); patharena += "arena_2_bone_pit/"; } break; case "arena3": if($(this).data('worth')){ $('.arena3').show(); $('.choosearena').hide(); patharena += "arena_3/"; } break; case "arena4": if($(this).data('worth')){ $('.arena4').show(); $('.choosearena').hide(); patharena += "arena_4/"; } break; case "arena5": if($(this).data('worth')){ $('.arena5').show(); $('.choosearena').hide(); patharena += "arena_5/"; } break; case "arena6": if($(this).data('worth')){ $('.arena6').show(); $('.choosearena').hide(); patharena += "arena_6/"; } break; case "arena7": if($(this).data('worth')){ $('.arena7').show(); $('.choosearena').hide(); patharena += "arena_7/"; } break; case "arena8": if($(this).data('worth')){ $('.arena8').show(); $('.choosearena').hide(); patharena += "arena_8/"; } break; case "arena9": if($(this).data('worth')){ $('.arena9').show(); $('.choosearena').hide(); patharena += "arena_9/"; } break; case "arena10": if($(this).data('worth')){ $('.arena10').show(); $('.choosearena').hide(); patharena += "arena_10/"; } break; case "arena11": if($(this).data('worth')){ $('.arena11').show(); $('.choosearena').hide(); patharena += "arena_11/"; } break; } }; /*********************************************get_unit_name********************************************/ var getunitname = function () { nameoftheunit = $(this).data("val"); }; /*********************************************play_camp_music********************************************/ var playcampmusic = function () { var nameofthesong = $(this).data("val"); var snd = new audio(patharena + "/" + nameofthesong + '.mp3'); snd.play(); }; /*********************************************play_music********************************************/ var playmusic = function () { var nameofthesong = $(this).data("val"); var snd = new audio(patharena + nameoftheunit + "/" + nameofthesong + '.mp3'); snd.play(); }; /*********************************************get_back********************************************/ var getback = function () { $('.choosearena').show(); hidestuff(); patharena = "assets/assets cr/"; }; /*********************************************init********************************************/ var init = function () { hidestuff(); $('.choosearena a').on('click', arenachoose); $('.arena a').on('click', getunitname); $('.arenasoundsmodals a').on('click', playcampmusic); $('.modalsarena a').on('click', playmusic); $('.btn-back').on('click', getback); }; $(document).ready(init());
i have error when pressed button:
04-15 14:22:12.435 e/egl_emulation: eglquerycontext 32c0 egl_bad_attribute 04-15 14:22:12.435 e/egl_emulation: tid 6551: eglquerycontext(1484): error 0x3004 (egl_bad_attribute) 04-15 14:22:12.447 e/cr_mediaresource: file not exist. 04-15 14:22:12.447 e/cr_mediaresource: unable configure metadata extractor
thanks helping me out!!
Comments
Post a Comment