{"name":"Multi Audio Player","key":"multiaudioplayer","version":"1.0.5","instructions":"This is an HTML5 audio player that will play the audio file only a fixed number of times.","showatto":"0","showplayers":"1","requirecss":"","requirejs":"","shim":"","defaults":"canplaycount=5,pause=fa-stop,play=fa-play,over=fa-minus,playing=fa-circle-o-notch","amd":"1","body":"<div id='@@AUTOID@@_container' class='poodll_multiplayer'>\n\t<div class=\"button-wrapper\">\n\t\t<button type='button'  id='@@AUTOID@@' class='poodll_multiplayer_button'>\n\t\t<audio id='@@AUTOID@@_player' class=\"onceplayerjs nomediaplugin\" src=\"@@VIDEOURL@@\"></audio>\n\t\t<i class=\"fa fa-play fa-2x\" aria-hidden=\"true\"></i></button>\n\t</div>\n\t<div class=\"state-wrapper\">\n\t\t<div id='@@AUTOID@@_time' class='poodll_onceplayer_time'></div>\n\t\t<!--<div id='@@AUTOID@@_state' class='poodll_onceplayer_state'></div>-->\n\t\t<div id='@@AUTOID@@_playtime' class=\"poodll_multiplayer_playtime\"></div>\n\t</div>\n\t<div class=\"volume-control\">\n\t\t<button type=\"button\" id=\"@@AUTOID@@_vol-up\" class=\"vol-up vol-but\">\n                         <i class=\"fa fa-volume-up fa-1x\" aria-hidden=\"true\"></i></button>\n\t\t<div class=\"meter\">\n\t\t\t<div id=\"@@AUTOID@@_indicator\" class=\"indicator\"></div>\n\t\t</div>\n\t\t<button type=\"button\" id=\"@@AUTOID@@_vol-down\" class=\"vol-down vol-but\">\n                    <i class=\"fa fa-volume-down fa-1x\" aria-hidden=\"true\"></i></button>\t\n\t</div>\n</div>","bodyend":"","script":"$('#' + @@AUTOID@@).attr('playtime', @@canplaycount@@);\n//get our player\nvar aplayer = $('#' + @@AUTOID@@).children().first();\nvar fa = $('#' + @@AUTOID@@ + ' .fa');\nvar thestate =$('#' + @@AUTOID@@ + '_state'); \nvar thetime = $('#' + @@AUTOID@@ + '_time'); \n\n\n$(fa).removeClass('fa-minus');\n\n//set status\nthestate.text('- ready -');\n\n// setting base volume for audio player\naplayer[0].volume = 0.2;\n\n// Append Playtime text\n$('#' + @@AUTOID@@ + '_playtime').empty();\nvar playtimer = $('#' + @@AUTOID@@).attr('playtime');\n$('#' + @@AUTOID@@ + '_playtime').append('Remaining plays: '+playtimer +'x');\n\n\n\n/* Volume Control */\n$('#' + @@AUTOID@@ + '_vol-up').click(function(){\n\t/* adding value to meter!*/\n\t$('#' + @@AUTOID@@ + '_indicator').css(\"width\", '+=' + (0.1 * $('.meter').width()));\n\t\n\tif(aplayer[0].volume == 1.1){\n\t\tAlert(\"max Volume\");\n\t}else{\n\t\taplayer[0].volume+=0.1;\t\n\t\tconsole.log(aplayer[0].volume);\n\t}\n});\n$('#' + @@AUTOID@@ + '_vol-down').click(function(){\n\t/* Subtracting value to meter!*/\n\t$('#' + @@AUTOID@@ + '_indicator').css(\"width\", '-=' + (0.1 * $('.meter').width()));\n\tif(aplayer[0] == 0.0){\n\t\talert(\"audio is mute !\");\n\t}else{\n\t\taplayer[0].volume-=0.1;\t\n\t\tconsole.log(aplayer[0].volume);\n\t}\n\t\n});\n\n   //player clicked event\n\t$('#' + @@AUTOID@@).click(function(){\n                //decrement playtime\n\t        var currentplaytime = $('#' + @@AUTOID@@).attr('playtime') -1;\n\t\t$('#' + @@AUTOID@@).attr('playtime',currentplaytime);\n\n\t\tplay_audio();\n\t\n\t\taplayer[0].addEventListener('ended', function(){\n\t\t  $('#' + @@AUTOID@@ + '_playtime').empty();\n\t\t  var playtime = $('#' + @@AUTOID@@).attr('playtime');\n\t\t\n\t\t  $(fa).removeClass(@@playing@@);\n\t\t  $(fa).removeClass('fa-spin');\n\t\t  $(fa).removeClass(@@play@@);\n\t\t  aplayer[0].pause();\t\n\t\t\n\t\t  if(playtime > 0){\t\n\t\t\t$('#' + @@AUTOID@@ + '_playtime').append('Remaining plays: '+playtime+'x');\n\t\t\t$(fa).removeClass('fa-minus');\n                        $(fa).addClass(@@play@@);\n\t\t  }else{\n\t\t\t$('#' + @@AUTOID@@ + '_playtime').append('Remaining plays: 0');\n\t\t\t$(fa).addClass('fa-minus');\n\t\t\tthestate.text('- finished -');\n\t\t\t$('#' + @@AUTOID@@).attr(\"disabled\", true);\n\t\t  }\t\n\t});\n});\n\n\nfunction play_audio(){\n\taplayer[0].play();\n\tthestate.text('- playing -');\n\t$(fa).removeClass(@@play@@);\n\t$(fa).addClass(@@playing@@);\n\t$(fa).addClass('fa-spin');\n}\n\n\naplayer.bind('durationchange',function(){thetime.text(poodll_mp_fetchtime(aplayer));});\n\n\n//time display function\nfunction poodll_mp_sec2time(seconds){\n    var date = new Date(null);\n    date.setSeconds(seconds); \n    return date.toISOString().substr(11, 8);\n}\nfunction poodll_mp_fetchtime(theplayer){\n     var a_currenttime= isNaN(theplayer[0].currentTime) ? 0 : theplayer[0].currentTime;\n     var a_duration= isNaN(theplayer[0].duration) ? 0 : theplayer[0].duration;\n     var currenttime = poodll_mp_sec2time(Math.floor(a_currenttime));\n     var totaltime = poodll_mp_sec2time(Math.floor(a_duration)); \n     var displaytime = currenttime + ' / ' +  totaltime;\n    return displaytime;\n}\n//The timer display\naplayer.on('timeupdate',function(e){\n var displaytime = poodll_mp_fetchtime(aplayer)\n thetime.text(displaytime);\n});\n\n//show current time\n thetime.text(poodll_mp_fetchtime(aplayer));\n\n","style":".poodll_multiplayer{\n\tborder: 3px solid #333;\n    width: 250px;\n    height: 120px;\n    text-align: center;\n    margin-bottom: 100px;\n    padding: 10px;\n    background-color: #333;\n    color: #fff;\n    position: relative;\n}\n.poodll_multiplayer  .skin{\n\theight: 200px;\n    BACKGROUND-IMAGE: url(http://img.wennermedia.com/social/bruno-mars--press-photo-2---kai-z-feng-885f1d8b-0fc8-4ea6-a613-06ef6ce4e443.jpg);\n    background-repeat: no-repeat;\n    background-size: 100%;\n}\n.poodll_multiplayer   .poodll_multiplayer_button{\n\tborder: none;\n\twidth: 50px;\n\theight: 42px;\n}\n.poodll_multiplayer .custom-pause:before{\n\n    content: \"\\f04b\";\n    font-family: FontAwesome;\n    font-style: normal;\n    font-weight: normal;\n    text-decoration: inherit;\n\n\t\n}\n.poodll_multiplayer .vol-but{\n    width: 25px;\n    float: right;\n    padding: 0px;\n}\n\n.poodll_multiplayer .meter{\n    width: 130px;\n    height: 15px;\n    border: 1px solid #333;\n    margin-top: 5px;\n    float: right;\n    margin-left: 5px;\n}\n.poodll_multiplayer .indicator{\n    height: 100%;\n    width: 20%;\n    background-color: red;\n\tmin-width: 0%;\n\tmax-width: 100%;\n}\n.poodll_multiplayer .button-wrapper{\n\twidth: 30%;\n\tfloat: left;\n}\n.poodll_multiplayer .state-wrapper{\n\twidth: 70%;\n\tfloat: left;\n}\n.poodll_multiplayer .volume-control{\n\tposition: absolute;\n    text-align: center;\n    bottom: 20px;\n}","dataset":"","datasetvars":"","alternate":"<audio id=\"@@AUTOID@@\" controls=\"controls\" class=\"nomediaplugin\">\n  <source src=\"@@VIDEOURL@@\" type=\"audio/mpeg\">\n</audio>","alternateend":""}