Skip to content

Commit

Permalink
multiplayer audio and video template icons and other fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
justinhunt committed May 22, 2024
1 parent 85d3966 commit 1af93a3
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 52 deletions.
2 changes: 1 addition & 1 deletion presets/multiaudioplayer.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"name":"Multi Audio Player","key":"multiaudioplayer","version":"1.0.3","instructions":"This is an HTML5 audio player that will play the audio file only a fixed number of times.","showatto":"0","showplayers":"1","requirecss":"//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css","requirejs":"","shim":"","defaults":"canplaycount=5,canpause=0,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\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\"></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\"></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$(fa).removeClass('fa-minus');\n\n//set status\nthestate.text('- ready -');\n\n\n// setting base volume for audio player\naplayer[0].volume = 0.2;\n\n\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\n\n//player clicked event\n\t$('#' + @@AUTOID@@).click(function(){\n\t\n\t\t$('#' + @@AUTOID@@).attr('playtime',@@canplaycount@@ - 1);\n\t\t//$('#' + @@AUTOID@@).children().first().attr('playtime', @@canplaycount@@ - 1);\n\t\tplay_audio();\n\t\n\t\n\t\n\t\taplayer[0].addEventListener('ended', function(){\n\t\t\n\t\t$('#' + @@AUTOID@@ + '_playtime').empty();\n\t\tvar 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\taplayer[0].pause();\t\n\t\t\n\t\t\n\t\tif(playtime > 0){\n\t\t\t\n\t\t\t$('#' + @@AUTOID@@ + '_playtime').append('Remaining plays: '+playtime+'x');\n\t\t\t$(fa).addClass('custom-pause');\n\t\t\t$(fa).removeClass('fa-minus');\n\t\t\t//thestate.text('- Play Again -');\n\t\t\t\n\t\t\t$('#' + @@AUTOID@@).click(function(){\n\t\t\t\t$('#' + @@AUTOID@@).attr('playtime',playtime - 1);\n\t\t\t\t$(fa).removeClass('custom-pause');\n\t\t\t\tplay_audio();\n\t\t\t\t\n\t\t\t});\n\t\t\t\n\t\t}else{\n\t\t\t$('#' + @@AUTOID@@ + '_playtime').append('Remaining plays: 0');\n\t\t\t$(fa).addClass('custom-pause');\n\t\t\tthestate.text('- finished -');\n\t\t\t$('#' + @@AUTOID@@).attr(\"disabled\", true);\n\t\t}\n\t\t\n\t});\n \n \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.poodll_multiplayer .volume-control .vol-up:before{\n\tcontent: \"\\f028\";\n font-family: FontAwesome;\n font-style: normal;\n font-weight: normal;\n text-decoration: inherit;\n}\n.poodll_multiplayer .volume-control .vol-down:before{\n\tcontent: \"\\f027\";\n font-family: FontAwesome;\n font-style: normal;\n font-weight: normal;\n text-decoration: inherit;\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":""}
{"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":""}
47 changes: 2 additions & 45 deletions styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -4727,35 +4727,13 @@ audio.poodll_preview_bmr {
width: 50px;
height: 42px;
}
.poodll_multiplayer .custom-pause:before {

content: "\f04b";
font-family: FontAwesome;
font-style: normal;
font-weight: normal;
text-decoration: inherit;


}
.poodll_multiplayer .vol-but {
width: 25px;
float: right;
padding: 0px;
}
.poodll_multiplayer .volume-control .vol-up:before {
content: "\f028";
font-family: FontAwesome;
font-style: normal;
font-weight: normal;
text-decoration: inherit;
}
.poodll_multiplayer .volume-control .vol-down:before {
content: "\f027";
font-family: FontAwesome;
font-style: normal;
font-weight: normal;
text-decoration: inherit;
}

.poodll_multiplayer .meter {
width: 130px;
height: 15px;
Expand Down Expand Up @@ -5039,34 +5017,13 @@ video.poodll_multivideoplayer_video {
width: 50px;
height: 42px;
}
.poodll_multivideoplayer .custom-pause:before{
content: "\f04b";
font-family: FontAwesome;
font-style: normal;
font-weight: normal;
text-decoration: inherit;


}
.poodll_multivideoplayer .vol-but{
width: 25px;
float: right;
padding: 0px;
}
.poodll_multivideoplayer .volume-control .vol-up:before{
content: "\f028";
font-family: FontAwesome;
font-style: normal;
font-weight: normal;
text-decoration: inherit;
}
.poodll_multivideoplayer .volume-control .vol-down:before{
content: "\f027";
font-family: FontAwesome;
font-style: normal;
font-weight: normal;
text-decoration: inherit;
}

.poodll_multivideoplayer .meter{
width: 80px;
height: 15px;
Expand Down
7 changes: 5 additions & 2 deletions templates/pw-multiplayeraudio.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,14 @@
<div id='{{AUTOID}}_playtime' class="poodll_multiplayer_playtime"></div>
</div>
<div class="volume-control">
<button type="button" id="{{AUTOID}}_vol-up" class="vol-up vol-but"></button>
<button type="button" id="{{AUTOID}}_vol-up" class="vol-up vol-but">
<i class="fa fa-volume-up fa-1x" aria-hidden="true"></i></button>
</button>
<div class="meter">
<div id="{{AUTOID}}_indicator" class="indicator"></div>
</div>
<button type="button" id="{{AUTOID}}_vol-down" class="vol-down vol-but"></button>
<button type="button" id="{{AUTOID}}_vol-down" class="vol-down vol-but">
<i class="fa fa-volume-down fa-1x" aria-hidden="true"></i></button>
</div>
</div>

Expand Down
10 changes: 6 additions & 4 deletions templates/pw-multiplayervideo.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@
<div id='{{AUTOID}}_playtime' class="poodll_multivideoplayer_playtime"></div>
</div>
<div class="volume-control">
<button type="button" id="{{AUTOID}}_vol-up" class="vol-up vol-but"></button>
<button type="button" id="{{AUTOID}}_vol-up" class="vol-up vol-but">
<i class="fa fa-volume-up fa-1x" aria-hidden="true"></i></button>
<div class="meter">
<div id="{{AUTOID}}_indicator" class="indicator"></div>
</div>
<button type="button" id="{{AUTOID}}_vol-down" class="vol-down vol-but"></button>
<button type="button" id="{{AUTOID}}_vol-down" class="vol-down vol-but">
<i class="fa fa-volume-down fa-1x" aria-hidden="true"></i></button>
</div>
</div><!-- end of controlbar -->
</figure>
Expand All @@ -41,7 +43,7 @@ $('#' + "{{AUTOID}}" + '_player').attr('src',details.mediaurl);
//get our player
var aplayer = $('#' + "{{AUTOID}}" + '_player');
var fa = $('#' + "{{AUTOID}}" + ' .fa');
var fa = $('#' + "{{AUTOID}}_playbutton" + ' .fa');
var thestate =$('#' + "{{AUTOID}}" + '_state');
var thetime = $('#' + "{{AUTOID}}" + '_time');
var playtimer = $('#' + "{{AUTOID}}");
Expand Down Expand Up @@ -133,7 +135,7 @@ $('#' + "{{AUTOID}}" + '_vol-down').click(function(){
});//end of ended listener
//player clicked event
$('#' + "{{AUTOID}}").click(function(){
$('#' + "{{AUTOID}}_playbutton").click(function(){
var playtimer = $('#' + "{{AUTOID}}");
var currentplaycount = playtimer.data('playtime');
if(currentplaycount==0){return;}
Expand Down

0 comments on commit 1af93a3

Please sign in to comment.