{"name":"VideoEmbed (widget)","key":"videoembed","version":"1.0.2","instructions":"This is a simple template to embed a Youtube or Vimeo video. Enter the Youtube or Vimeo URL. It also allows you set the start time in seconds.","showatto":"1","showplayers":"0","requirecss":"","requirejs":"","shim":"","defaults":"width=800,start=0","amd":"1","body":"<div id=\"@@AUTOID@@\">\n<script src=\"https://player.vimeo.com/api/player.js\"></script>\n</div>\n\n","bodyend":"","script":"var video_embed_template ='<div style=\"max-width:' + @@width@@ +  'px\"><div style=\"padding:60.44% 0 0 0;position:relative;\"><iframe src=\"@videourl@\" style=\"position:absolute;top:0;left:0;width:100%;height:100%;\" frameborder=\"0\" allow=\"autoplay; fullscreen; picture-in-picture\" allowfullscreen></iframe></div></div>';\n\nfunction parseVideoURL(url) {\n\n        var retVal = {};\n        var matches;\n        var success = false;\n\n        if ( url.match('http(s)?://(www.)?youtube|youtu\\.be') ) {\n          if (url.match('embed')) { retVal.id = url.split(/embed\\//)[1].split('\"')[0]; }\n           else if (url.match('shorts')) { retVal.id = url.split(/shorts\\//)[1].split('\"')[0]; }\n            else { retVal.id = url.split(/v\\/|v=|youtu\\.be\\//)[1].split(/[?&]/)[0]; }\n            retVal.provider = \"youtube\";\n            retVal.params = \"?rel=0&start=\" + @@start@@;\n            retVal.videoUrl = '//www.youtube.com/embed/' + retVal.id;\n            retVal.success = true;\n        } else if (matches = url.match(/vimeo.com\\/(\\d+)/)) {\n            retVal.provider = \"vimeo\";\n            retVal.params = \"?h=874d9d7ec4&color=F5975F&title=0&byline=0&portrait=0#t=\" + @@start@@ + \"s\";\n            retVal.id = matches[1];\n            retVal.videoUrl = '//player.vimeo.com/video/' + retVal.id;\n            retVal.success = true;\n        }\n        return retVal;\n}\nvar videodetails = parseVideoURL(@@video_url@@);\nif(videodetails.success){\n  playerTemplate = video_embed_template.replace('@videourl@',videodetails.videoUrl + videodetails.params);\n  document.getElementById(@@AUTOID@@).innerHTML=playerTemplate;\n}\n\n","style":"","dataset":"","datasetvars":"","alternate":"","alternateend":""}