{"id":14874,"date":"2014-07-31T15:06:52","date_gmt":"2014-07-31T09:36:52","guid":{"rendered":"http:\/\/www.tothenew.com\/blog\/?p=14874"},"modified":"2016-12-19T15:33:31","modified_gmt":"2016-12-19T10:03:31","slug":"youtube-integration-with-cq5","status":"publish","type":"post","link":"https:\/\/www.tothenew.com\/blog\/youtube-integration-with-cq5\/","title":{"rendered":"YouTube Integration with CQ5"},"content":{"rendered":"<p style=\"text-align: left\">Managing multimedia content to any large scale website is much complicated if the content is dynamic and needs to be changed at regular intervals. Integration of YouTube with CQ5 is one of the use case which can help authors to manage the channel specific videos for particular page related with particular channel.<\/p>\n<p>Below is the snapshot how this solution will work:<\/p>\n<p><a href=\"\/blog\/wp-ttn-blog\/uploads\/2014\/07\/yt.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone  wp-image-14974\" src=\"\/blog\/wp-ttn-blog\/uploads\/2014\/07\/yt.png\" alt=\"UseCase\" width=\"440\" height=\"238\" \/><\/a><\/p>\n<p>1) \u00a0\u00a0\u00a0\u00a0\u00a0Create the configuration page for specific channel under the cloud service page of \u00a0Youtube .<\/p>\n<p><a href=\"\/blog\/wp-ttn-blog\/uploads\/2014\/07\/createconfig.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone  wp-image-14979\" src=\"\/blog\/wp-ttn-blog\/uploads\/2014\/07\/createconfig.png\" alt=\"createconfig\" width=\"540\" height=\"217\" \/><\/a><\/p>\n<p>2)\u00a0\u00a0\u00a0\u00a0\u00a0 Create a dialog which will accept Channel ID, API Key &amp; Target Path (Store location in DAM) &amp; link this to the YouTube cloud service. This will validate the Google Key\/ Channel Id. On success it will configure the cloud service with that channel.<\/p>\n<p><a href=\"\/blog\/wp-ttn-blog\/uploads\/2014\/07\/service.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone  wp-image-14983\" src=\"\/blog\/wp-ttn-blog\/uploads\/2014\/07\/service.png\" alt=\"service\" width=\"581\" height=\"238\" \/><\/a><\/p>\n<p>3) \u00a0 \u00a0 \u00a0Our dialog is configured with some hidden widgets which cause the creation of polling node just below the jcr:content of cloud service page. This binds our cloud service with one channel correspond to polling node which will invoke the generic importer.<\/p>\n<p><a href=\"\/blog\/wp-ttn-blog\/uploads\/2014\/07\/importer.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-14984\" src=\"\/blog\/wp-ttn-blog\/uploads\/2014\/07\/importer.png\" alt=\"importer\" width=\"1343\" height=\"272\" \/><\/a><\/p>\n<p>Listener will\u00a0set values of polling node when we click OK.<\/p>\n<p><a href=\"\/blog\/wp-ttn-blog\/uploads\/2014\/07\/polling.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-14985\" src=\"\/blog\/wp-ttn-blog\/uploads\/2014\/07\/polling.png\" alt=\"polling\" width=\"1169\" height=\"177\" \/><\/a><\/p>\n<p>4) \u00a0 \u00a0 \u00a0\u00a0Now the polling node will poll the youtube service<\/p>\n<p>[html]<\/p>\n<p>https:\/\/www.googleapis.com\/youtube\/v3\/search?key=\u201d+ key+ \u201c<br \/>\n&amp;amp;part=snippet,id&amp;amp;order=date&amp;amp;maxResults=50&amp;amp;type=video<br \/>\n&amp;amp;channelId=\u201d+ channelId + \u201c&amp;amp;pageToken=\u201d + pageToken<\/p>\n<p>[\/html]<\/p>\n<p>via importers (A custom servlet <a href=\"https:\/\/github.com\/IntelligrapeAEM\/IgWebCMS\/blob\/master\/ig-igwebcms-services\/src\/main\/java\/com\/ig\/igwebcms\/servlets\/YouTubeChannelImporter.java\">YoutubeChannelImporter.java<\/a>)<\/p>\n<p>5) \u00a0 \u00a0\u00a0Our importer is responsible for storing videos in DAM at target path which we have specified in step 2<\/p>\n<p>6) \u00a0 \u00a0 \u00a0After execution of importer, we can check the nodes under target path which are assets that refer to YouTube videos for specific channel.<\/p>\n<p><a href=\"\/blog\/wp-ttn-blog\/uploads\/2014\/07\/imageres.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-14987\" src=\"\/blog\/wp-ttn-blog\/uploads\/2014\/07\/imageres.png\" alt=\"imageres\" width=\"1105\" height=\"338\" \/><\/a><\/p>\n<p>7)\u00a0Now we need to customize the content finder to create a new tab which will show the YouTube videos stored under DAM.<\/p>\n<p><strong>How to create new contentfiner tab in CQ5.<\/strong><\/p>\n<p>8)\u00a0 Create a servlet AssetViewHandler which render the videos from DAM to content finder tab on the request basis for particular page. We can use OOTB servlet available in package <strong>com.day.cq.wcm.core.impl.servlets.contentfinder <\/strong>with some changes as we are fetching assets on page basis.<\/p>\n<p>9) Now click on the page properties and select the cloud service for specific channel &amp; save.<\/p>\n<p><a href=\"\/blog\/wp-ttn-blog\/uploads\/2014\/07\/cloudserice.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-14988\" src=\"\/blog\/wp-ttn-blog\/uploads\/2014\/07\/cloudserice.png\" alt=\"cloudservice\" width=\"1032\" height=\"329\" \/><\/a><\/p>\n<p>10)\u00a0Open the en.html page, you can find the new tab in content finder with YouTube icon. And here all the videos are populated from DAM. Add the component YouTube to parsys which use the iframe, it uses the YouTube video\u2019s id.<\/p>\n<p><a href=\"\/blog\/wp-ttn-blog\/uploads\/2014\/07\/component1.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone  wp-image-14990\" src=\"\/blog\/wp-ttn-blog\/uploads\/2014\/07\/component1.png\" alt=\"component1\" width=\"615\" height=\"208\" \/><\/a><\/p>\n<p>11) Just drag and drop the video on the Youtube component.<\/p>\n<p><a href=\"\/blog\/wp-ttn-blog\/uploads\/2014\/07\/image.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-14992\" src=\"\/blog\/wp-ttn-blog\/uploads\/2014\/07\/image.png\" alt=\"image\" width=\"1164\" height=\"450\" \/><\/a><\/p>\n<p>GitHub link :\u00a0<a style=\"color: #1155cc\" href=\"https:\/\/github.com\/IntelligrapeAEM\/IgWebCMS\" target=\"_blank\">https:\/\/github.com\/IntelligrapeAEM\/IgWebCMS<\/a><\/p>\n<p>Hope this helps!!!<br \/>\nVivek Dhiman<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Managing multimedia content to any large scale website is much complicated if the content is dynamic and needs to be changed at regular intervals. Integration of YouTube with CQ5 is one of the use case which can help authors to manage the channel specific videos for particular page related with particular channel. Below is the [&hellip;]<\/p>\n","protected":false},"author":128,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"iawp_total_views":9},"categories":[1],"tags":[1235,4847,1494,1495],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/14874"}],"collection":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/users\/128"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/comments?post=14874"}],"version-history":[{"count":0,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/14874\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/media?parent=14874"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/categories?post=14874"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/tags?post=14874"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}