{"name":"MultiSpeed Player Widget","key":"pw-multispeedplayer","version":"1.0.1","instructions":"Insert an audio player or audio link between the tags. The multi speed audio player will take over.","showatto":"1","showplayers":"0","requirecss":"","requirejs":"","shim":"","defaults":"","amd":"1","body":"<div id='@@AUTOID@@_container' style=\"display: none; max-width: 330px; width: 100%;\">\n<button onclick=\"SlowSpeed('@@AUTOID@@')\" type=\"button\"><img src=\"@@WWWROOT@@/filter/poodll/3rdparty/adamplayer/slowspeed.png\" alt=\"80% (Turtle)\">80%</button>\n<button onclick=\"RegularSpeed('@@AUTOID@@')\" type=\"button\"><img src=\"@@WWWROOT@@/filter/poodll/3rdparty/adamplayer/regularspeed.png\" alt=\"100% (Regular)\">100%</button> \n<button onclick=\"FastSpeed('@@AUTOID@@')\" type=\"button\"><img src=\"@@WWWROOT@@/filter/poodll/3rdparty/adamplayer/fastspeed.png\" alt=\"125% (Rabbit)\">125%</button><br />\n<audio id=\"@@AUTOID@@\" preload=\"meta\" controls=\"controls\" class=\"nomediaplugin\" >\n</audio>\n<div id=\"@@AUTOID@@_original\" class=\"poodllplayerwidgetnoshow\" style=\"display: none\">\n\n\n","bodyend":"</div>","script":"function parseMedia(containerid, mediatype) {\n           var ret = {};\n           ret.mediaurl = false;\n           ret.lang = false;\n           ret.subtitlesurl = false;\n           ret.sources = false;\n           ret.imgurl = false;\n\n           //do we have an audio player?\n           var originalplayer = $('#' + containerid + ' ' + mediatype).first();\n           if (originalplayer.length === 1) {\n\n               ret.lang = $('#' + containerid + ' ' + mediatype + ' track[kind=\"captions\"]').first().attr('srclang');\n               ret.subtitlesurl = $('#' + containerid + ' ' + mediatype + ' track[kind=\"captions\"]').first().attr('src');\n\n               if (originalplayer.attr('src') !== undefined) {\n                   ret.mediaurl = originalplayer.attr('src');\n               } else {\n                   ret.mediaurl = $('#' + containerid + ' ' + mediatype + ' source').first().attr('src');\n               }\n               ret.sources = $('#' + containerid + ' ' + mediatype + ' source');\n\n\n               //make sure moodle and poodll leave it alone from here on\n               originalplayer.addClass('nomediaplugin');\n               originalplayer.addClass('nopoodll');\n           } else {\n\n               //hopefully we have data attributes in the a link\n               var originallink = $('#' + containerid + ' a').first();\n               ret.mediaurl = originallink.attr('href');\n               ret.lang = originallink.attr('data-lang');\n               ret.subtitlesurl = originallink.attr('data-subtitles');\n               ret.imgurl = originallink.attr('data-img');\n\n               //but we might be in the old form where they were params on the url\n               if (ret.subtitlesurl === undefined && ret.mediaurl.split('?').length > 0) {\n                   var urlParams = new URLSearchParams(ret.mediaurl.split('?')[1]);\n                   ret.subtitlesurl = urlParams.get('data-subtitles');\n                   ret.lang = urlParams.get('data-language');\n                   ret.mediaurl = mediaurl.split('?')[0]\n               }\n\n               //make sure moodle and poodll leave it alone from here on\n               originallink.addClass('nomediaplugin');\n               originallink.addClass('nopoodll');\n           }\n\n           //do we have an image\n           if(!ret.imgurl) {\n               var originalimg = $('#' + containerid + ' img').first();\n               if (originalimg.length === 1) {\n                   ret.imgurl = originalimg.attr('src');\n                   ;\n               }\n           }\n\n           return ret; \n }//end of parse function\n\n\nvar mediadetails= parseMedia(@@AUTOID@@ + '_original', 'audio');\n$('#' + @@AUTOID@@ + '_container').show();\n$('#' + @@AUTOID@@).attr('src', mediadetails.mediaurl);\n\n","style":"","dataset":"","datasetvars":"","alternate":"<audio id=\"@@AUTOID@@\" controls=\"controls\" class=\"nomediaplugin\">\n  <source src=\"@@VIDEOURL@@\" type=\"audio/mpeg\">\n</audio>","alternateend":""}