{"id":2207,"date":"2010-12-14T10:47:36","date_gmt":"2010-12-14T05:17:36","guid":{"rendered":"https:\/\/tothenewco.pro\/blog\/?p=2207"},"modified":"2016-12-16T12:15:30","modified_gmt":"2016-12-16T06:45:30","slug":"using-custom-tag-for-embedding-the-video-in-grails","status":"publish","type":"post","link":"https:\/\/tothenewco.pro\/blog\/using-custom-tag-for-embedding-the-video-in-grails\/","title":{"rendered":"Using Custom Tag for embedding the Video in Grails"},"content":{"rendered":"<p><!-- pre.cjk { font-family: \"DejaVu Sans\",monospace; }p { margin-bottom: 0.08in; }a:link {  } -->I had to make a video available on my GSP page. So I looked at the <a href=\"http:\/\/www.grails.org\/plugin\/flash-player\" target=\"_blank\">grails flash-player plugin<\/a>.\u00a0\u00a0After going through the documentation I found that it could not be used with videos on YouTube.<\/p>\n<p>This code given below will generate the script for the flash player on your GSP for playing youtube videos.<\/p>\n<p>[html]<br \/>\n&lt;object width=&quot;480&quot; height=&quot;385&quot;&gt;<br \/>\n&lt;param name=&quot;movie&quot; value=&quot;http:\/\/www.youtube-nocookie.com\/v\/YG9RGKYauhE?fs=1&amp;amp;amp;hl=en_US&quot;&gt;<br \/>\n&lt;\/param&gt;<br \/>\n&lt;param name=&quot;allowFullScreen&quot; value=&quot;true&quot;&gt;&lt;\/param&gt;&lt;param name=&quot;allowscriptaccess&quot; value=&quot;always&quot;&gt;<br \/>\n&lt;\/param&gt;<br \/>\n&lt;embed src=&quot;http:\/\/www.youtube-nocookie.com\/v\/YG9RGKYauhE?fs=1&amp;amp;amp;hl=en_US&quot;<br \/>\ntype=&quot;application\/x-shockwave-flash&quot; allowscriptaccess=&quot;always&quot; allowfullscreen=&quot;true&quot; width=&quot;480&quot;<br \/>\nheight=&quot;385&quot;&gt;<br \/>\n&lt;\/embed&gt;&lt;\/object&gt;<br \/>\n[\/html]<\/p>\n<p>This is the general code for a YouTube video. URL in the browser for video looks like -http:\/\/www.youtube.com\/watch?v=<strong>YG9RGKYauhE<\/strong>&amp;feature=related.<\/p>\n<p>The common thing between embed code and URL of video is the<strong> key<\/strong> for the video which uniquely identifies it. So copy and paste the code in your GSP page and pass the video key to change the video as you want.<\/p>\n<p><strong>But to make it simple I made a custom tag like&#8211;<\/strong><\/p>\n<p>[groovy]<br \/>\ndef video={attrs-&gt;<br \/>\n        def videoKey=attrs[&#8216;videoKey&#8217;]<br \/>\n         def vd={<br \/>\n           object(width:attrs[&#8216;width&#8217;]?:&quot;640&quot;,height:attrs[&#8216;height&#8217;]?:&quot;385&quot;){<br \/>\n             param(name:&quot;movie&quot;,value:&quot;http:\/\/www.youtube-nocookie.com\/v\/${videoKey}?fs=1&amp;amp;amp;hl=en_US&quot;)<br \/>\n             param(name:&quot;allowFullScreen&quot;,value:&quot;true&quot;)<br \/>\n             param(name:&quot;allowscriptaccess&quot;,value:&quot;always&quot;)<br \/>\n             embed(src:&quot;http:\/\/www.youtube-nocookie.com\/v\/${videoKey}?fs=1&amp;amp;amp;hl=en_US&quot;,<br \/>\ntype:&quot;application\/x-shockwave-flash&quot;,allowscriptaccess:&quot;always&quot;,allowfullscreen:&quot;true&quot;,<br \/>\nwidth:&quot;${attrs[&#8216;width&#8217;]?:&#8217;640&#8242;}&quot;, height:&quot;${attrs[&#8216;height&#8217;]?:&#8217;385&#8242;}&quot;)<\/p>\n<p>           }<\/p>\n<p>         }<br \/>\n         def xml=new groovy.xml.StreamingMarkupBuilder().bind(vd)<br \/>\n         out&lt;&lt;xml<br \/>\n}<br \/>\n[\/groovy]<\/p>\n<p>so you just need to write the following tag which will set its default height, width etc.<\/p>\n<p>[html]&lt;my:image videoKey=\u201d&#8212;&#8212;-the key from youtube&#8212;&#8212;&#8212;\u201d \/&gt;[\/html]<\/p>\n<p>I hope\u00a0this helps!<\/p>\n<p><!-- p { margin-bottom: 0.08in; } --><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I had to make a video available on my GSP page. So I looked at the grails flash-player plugin.\u00a0\u00a0After going through the documentation I found that it could not be used with videos on YouTube. This code given below will generate the script for the flash player on your GSP for playing youtube videos. [html] [&hellip;]<\/p>\n","protected":false},"author":27,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"iawp_total_views":6,"footnotes":""},"categories":[7],"tags":[4304,4840,4303],"class_list":["post-2207","post","type-post","status-publish","format-standard","hentry","category-grails","tag-embedding-video-in-grails","tag-grails","tag-using-custom-tag-for-embedding-the-video-in-grails"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.0.1 - aioseo.com -->\n\t<meta name=\"description\" content=\"Steps for Using Custom Tag for embedding the Video in Grails\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Anuj Aneja\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/tothenewco.pro\/blog\/using-custom-tag-for-embedding-the-video-in-grails\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.0.1\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"TO THE NEW BLOG\" \/>\n\t\t<meta property=\"og:type\" content=\"blog\" \/>\n\t\t<meta property=\"og:title\" content=\"Using Custom Tag for embedding the Video in Grails | TO THE NEW Blog\" \/>\n\t\t<meta property=\"og:description\" content=\"Steps for Using Custom Tag for embedding the Video in Grails\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/tothenewco.pro\/blog\/using-custom-tag-for-embedding-the-video-in-grails\/\" \/>\n\t\t<meta property=\"og:image\" content=\"https:\/\/tothenewco.pro\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png\" \/>\n\t\t<meta property=\"og:image:secure_url\" content=\"https:\/\/tothenewco.pro\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:site\" content=\"@tothenew\" \/>\n\t\t<meta name=\"twitter:title\" content=\"Using Custom Tag for embedding the Video in Grails | TO THE NEW Blog\" \/>\n\t\t<meta name=\"twitter:description\" content=\"Steps for Using Custom Tag for embedding the Video in Grails\" \/>\n\t\t<meta name=\"twitter:image\" content=\"https:\/\/tothenewco.pro\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/using-custom-tag-for-embedding-the-video-in-grails\\\/#article\",\"name\":\"Using Custom Tag for embedding the Video in Grails | TO THE NEW Blog\",\"headline\":\"Using Custom Tag for embedding the Video in Grails\",\"author\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/anuj\\\/#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#organization\"},\"datePublished\":\"2010-12-14T10:47:36+05:30\",\"dateModified\":\"2016-12-16T12:15:30+05:30\",\"inLanguage\":\"en-US\",\"commentCount\":1,\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/using-custom-tag-for-embedding-the-video-in-grails\\\/#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/using-custom-tag-for-embedding-the-video-in-grails\\\/#webpage\"},\"articleSection\":\"Grails, embedding Video in Grails, Grails, Using Custom Tag for embedding the Video in Grails\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/using-custom-tag-for-embedding-the-video-in-grails\\\/#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.tothenew.com\\\/blog\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/category\\\/grails\\\/#listItem\",\"name\":\"Grails\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/category\\\/grails\\\/#listItem\",\"position\":2,\"name\":\"Grails\",\"item\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/category\\\/grails\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/using-custom-tag-for-embedding-the-video-in-grails\\\/#listItem\",\"name\":\"Using Custom Tag for embedding the Video in Grails\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/using-custom-tag-for-embedding-the-video-in-grails\\\/#listItem\",\"position\":3,\"name\":\"Using Custom Tag for embedding the Video in Grails\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/category\\\/grails\\\/#listItem\",\"name\":\"Grails\"}}]},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#organization\",\"name\":\"TO THE NEW Blog\",\"url\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/anuj\\\/#author\",\"url\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/anuj\\\/\",\"name\":\"Anuj Aneja\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/using-custom-tag-for-embedding-the-video-in-grails\\\/#authorImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/26506d32d9a4d14f9fa04eedd76468df74b43724e0014df4900dadc5f9cd2ff7?s=96&d=mm&r=g\",\"width\":96,\"height\":96,\"caption\":\"Anuj Aneja\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/using-custom-tag-for-embedding-the-video-in-grails\\\/#webpage\",\"url\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/using-custom-tag-for-embedding-the-video-in-grails\\\/\",\"name\":\"Using Custom Tag for embedding the Video in Grails | TO THE NEW Blog\",\"description\":\"Steps for Using Custom Tag for embedding the Video in Grails\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/using-custom-tag-for-embedding-the-video-in-grails\\\/#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/anuj\\\/#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/anuj\\\/#author\"},\"datePublished\":\"2010-12-14T10:47:36+05:30\",\"dateModified\":\"2016-12-16T12:15:30+05:30\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/\",\"name\":\"TO THE NEW Blog\",\"inLanguage\":\"en-US\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#organization\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"Using Custom Tag for embedding the Video in Grails | TO THE NEW Blog","description":"Steps for Using Custom Tag for embedding the Video in Grails","canonical_url":"https:\/\/tothenewco.pro\/blog\/using-custom-tag-for-embedding-the-video-in-grails\/","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/tothenewco.pro\/blog\/using-custom-tag-for-embedding-the-video-in-grails\/#article","name":"Using Custom Tag for embedding the Video in Grails | TO THE NEW Blog","headline":"Using Custom Tag for embedding the Video in Grails","author":{"@id":"https:\/\/tothenewco.pro\/blog\/author\/anuj\/#author"},"publisher":{"@id":"https:\/\/tothenewco.pro\/blog\/#organization"},"datePublished":"2010-12-14T10:47:36+05:30","dateModified":"2016-12-16T12:15:30+05:30","inLanguage":"en-US","commentCount":1,"mainEntityOfPage":{"@id":"https:\/\/tothenewco.pro\/blog\/using-custom-tag-for-embedding-the-video-in-grails\/#webpage"},"isPartOf":{"@id":"https:\/\/tothenewco.pro\/blog\/using-custom-tag-for-embedding-the-video-in-grails\/#webpage"},"articleSection":"Grails, embedding Video in Grails, Grails, Using Custom Tag for embedding the Video in Grails"},{"@type":"BreadcrumbList","@id":"https:\/\/tothenewco.pro\/blog\/using-custom-tag-for-embedding-the-video-in-grails\/#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/tothenewco.pro\/blog#listItem","position":1,"name":"Home","item":"https:\/\/tothenewco.pro\/blog","nextItem":{"@type":"ListItem","@id":"https:\/\/tothenewco.pro\/blog\/category\/grails\/#listItem","name":"Grails"}},{"@type":"ListItem","@id":"https:\/\/tothenewco.pro\/blog\/category\/grails\/#listItem","position":2,"name":"Grails","item":"https:\/\/tothenewco.pro\/blog\/category\/grails\/","nextItem":{"@type":"ListItem","@id":"https:\/\/tothenewco.pro\/blog\/using-custom-tag-for-embedding-the-video-in-grails\/#listItem","name":"Using Custom Tag for embedding the Video in Grails"},"previousItem":{"@type":"ListItem","@id":"https:\/\/tothenewco.pro\/blog#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/tothenewco.pro\/blog\/using-custom-tag-for-embedding-the-video-in-grails\/#listItem","position":3,"name":"Using Custom Tag for embedding the Video in Grails","previousItem":{"@type":"ListItem","@id":"https:\/\/tothenewco.pro\/blog\/category\/grails\/#listItem","name":"Grails"}}]},{"@type":"Organization","@id":"https:\/\/tothenewco.pro\/blog\/#organization","name":"TO THE NEW Blog","url":"https:\/\/tothenewco.pro\/blog\/"},{"@type":"Person","@id":"https:\/\/tothenewco.pro\/blog\/author\/anuj\/#author","url":"https:\/\/tothenewco.pro\/blog\/author\/anuj\/","name":"Anuj Aneja","image":{"@type":"ImageObject","@id":"https:\/\/tothenewco.pro\/blog\/using-custom-tag-for-embedding-the-video-in-grails\/#authorImage","url":"https:\/\/secure.gravatar.com\/avatar\/26506d32d9a4d14f9fa04eedd76468df74b43724e0014df4900dadc5f9cd2ff7?s=96&d=mm&r=g","width":96,"height":96,"caption":"Anuj Aneja"}},{"@type":"WebPage","@id":"https:\/\/tothenewco.pro\/blog\/using-custom-tag-for-embedding-the-video-in-grails\/#webpage","url":"https:\/\/tothenewco.pro\/blog\/using-custom-tag-for-embedding-the-video-in-grails\/","name":"Using Custom Tag for embedding the Video in Grails | TO THE NEW Blog","description":"Steps for Using Custom Tag for embedding the Video in Grails","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/tothenewco.pro\/blog\/#website"},"breadcrumb":{"@id":"https:\/\/tothenewco.pro\/blog\/using-custom-tag-for-embedding-the-video-in-grails\/#breadcrumblist"},"author":{"@id":"https:\/\/tothenewco.pro\/blog\/author\/anuj\/#author"},"creator":{"@id":"https:\/\/tothenewco.pro\/blog\/author\/anuj\/#author"},"datePublished":"2010-12-14T10:47:36+05:30","dateModified":"2016-12-16T12:15:30+05:30"},{"@type":"WebSite","@id":"https:\/\/tothenewco.pro\/blog\/#website","url":"https:\/\/tothenewco.pro\/blog\/","name":"TO THE NEW Blog","inLanguage":"en-US","publisher":{"@id":"https:\/\/tothenewco.pro\/blog\/#organization"}}]},"og:locale":"en_US","og:site_name":"TO THE NEW BLOG","og:type":"blog","og:title":"Using Custom Tag for embedding the Video in Grails | TO THE NEW Blog","og:description":"Steps for Using Custom Tag for embedding the Video in Grails","og:url":"https:\/\/tothenewco.pro\/blog\/using-custom-tag-for-embedding-the-video-in-grails\/","og:image":"https:\/\/tothenewco.pro\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png","og:image:secure_url":"https:\/\/tothenewco.pro\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png","twitter:card":"summary","twitter:site":"@tothenew","twitter:title":"Using Custom Tag for embedding the Video in Grails | TO THE NEW Blog","twitter:description":"Steps for Using Custom Tag for embedding the Video in Grails","twitter:image":"https:\/\/tothenewco.pro\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png"},"aioseo_meta_data":{"post_id":"2207","title":null,"description":"Steps for Using Custom Tag for embedding the Video in Grails","keywords":null,"keyphrases":null,"primary_term":null,"canonical_url":null,"og_title":"","og_description":"","og_object_type":"blog","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":"","og_custom_url":null,"og_article_section":"","og_article_tags":"","twitter_use_og":false,"twitter_card":"summary","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"Article","isEnabled":true},"graphs":[]},"schema_type":null,"schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"local_seo":null,"limit_modified_date":false,"created":"2021-04-29 22:42:30","updated":"2024-02-29 09:33:28","focus_keyword":null,"additional_keywords":null,"truseo_locale":null,"ai":null,"breadcrumb_settings":null,"seo_analyzer_scan_date":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/tothenewco.pro\/blog\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/tothenewco.pro\/blog\/category\/grails\/\" title=\"Grails\">Grails<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tUsing Custom Tag for embedding the Video in Grails\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/tothenewco.pro\/blog"},{"label":"Grails","link":"https:\/\/tothenewco.pro\/blog\/category\/grails\/"},{"label":"Using Custom Tag for embedding the Video in Grails","link":"https:\/\/tothenewco.pro\/blog\/using-custom-tag-for-embedding-the-video-in-grails\/"}],"_links":{"self":[{"href":"https:\/\/tothenewco.pro\/blog\/wp-json\/wp\/v2\/posts\/2207","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tothenewco.pro\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tothenewco.pro\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tothenewco.pro\/blog\/wp-json\/wp\/v2\/users\/27"}],"replies":[{"embeddable":true,"href":"https:\/\/tothenewco.pro\/blog\/wp-json\/wp\/v2\/comments?post=2207"}],"version-history":[{"count":0,"href":"https:\/\/tothenewco.pro\/blog\/wp-json\/wp\/v2\/posts\/2207\/revisions"}],"wp:attachment":[{"href":"https:\/\/tothenewco.pro\/blog\/wp-json\/wp\/v2\/media?parent=2207"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tothenewco.pro\/blog\/wp-json\/wp\/v2\/categories?post=2207"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tothenewco.pro\/blog\/wp-json\/wp\/v2\/tags?post=2207"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}