{"name":"Once Video Player","key":"oncevideoplayer","version":"1.0.0","instructions":"This is an HTML5 video player that will play the video file only once/twice/thrice etc","showatto":"0","showplayers":"1","requirecss":"//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css","requirejs":"","shim":"","defaults":"canplaycount=1,canpause=0,pause=fa-stop,play=fa-play,over=fa-minus,playing=fa-circle-o-notch,WIDTH=400","amd":"1","body":"\n
\n\n\t
\n\t\t\n\t
\n\t
\n\t\t
\n\t\t\n\t\t
\n\t
\n\t
\n\t\t\n\t\t
\n\t\t\t
\n\t\t
\n\t\t\t\n\t
\n
","bodyend":"","script":"$('#' + @@AUTOID@@).attr('playtime', @@canplaycount@@);\n//get our player\nvar aplayer = $('#' + @@AUTOID@@ + '_player');\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 video 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_video();\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_video(){\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: 400px;\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-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: 300px;\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":"","alternateend":""}