A Youtube Connector for Sitecore Media Framework Part 1

Happy Father’s Day to all the fathers out there. It has been  a very exciting couple of weeks for us at Nish Tech. Cincinnati Chamber of Commerce selected us as the Winner of 2014 Business of the Year. We are working on many cutting edge technologies in Sitecore and other areas. Just this week, Nick Wesselman (.@techphoria414) from Active Commerce visited our office. Two hours of conversation with Nick was absolutely awesome. You must check out Nick’s presentation on Sitecore 7.5, if you haven’t already.

Nick, Suresh and me

Well, enough chitchat. Let’s start talking about the real reason for this blog. Recently, I had an opportunity to work on new Sitecore Media Framework and it’s Brightcove Connector for one of our clients at Nish Tech. Sitecore created an excellent open architecture for Media Framework and for that reason it is now easy to manage any video service from Sitecore, based on this extensible architecture. In this multi part blog, I will create a Media Framework Connector for Youtube Videos and on the way we will learn few things.

Before I get into the subject, I need to say, as I write the blog, I will provide some code. The code I will provide here are not production standard code. The purpose of the blog is to explain the concept. When I am ready, I might upload the code in Github or in Sitecore Marketplace. Also, You should check out a similar blog by Nick Allen. He is blogging on Media Framework Connector for Vimeo.

The first two parts of the blog, I will talk about the setup and information architecture. In this first part, I will go through the setup process and creating different items in the Core database for our Media Framework Youtube Connector.

You can find the Installation Package for Sitecore Media Framework 1.4 in SDN. We need to download and install only the Sitecore Media Framework 1.4 package. We will build our Youtube Connector on the top of that. The installation is as easy as any other Sitecore package. Once the Sitecore Media Framework 1.4 is installed with the help of ‘Installation Wizard’, open up the Content Editor and expand Media Library. You should see ‘Media Framework’ folder and also a ‘Media Framework’ tab in the ribbon.

Sitecore Media Framwork

If I select Media Framework tab, we can see two command buttons on the ribbon, ‘Export All’ and ‘Upload’. Both of these buttons work in the context of a Media Framework account and since we haven’t created any account yet, they have nothing to do now.

Sitecore Media Framework

Now it is time to add Buttons and Menus for our Youtube Connector. Let’s open up the Content Editor for the Core database and check the Media Framework Chunks and Menus.

Sitecore Media Framework

We have already seen the Export All and Upload in the ribbon. What we will be focusing on is ‘Import Content’ Chuck. Here we will be adding a ‘Import All’ command button for importing all types of content data (i.e. Video data and Playlists) from youtube. Underneath the ‘Import All’ we will have ‘Import Videos’ and ‘Import Playlists’ menu. Following figure shows the fields for ‘Youtube Import Button’. Clicking on the button will execute the type associated with the ‘mediaFramework:ManualImport:Youtube’ command with scope that indicates it will import both Video data and Playlists data. We will add this command in the ‘Sitecore.MediaFramework.Services.Youtube.config’ file. The Menu field includes location of the menus under ‘Import All’.

Sitecore Media Framework

Now we will create the Menus. Navigate to the Item folder ‘/sitecore/content/Applications/Content Editor/Menues/Media Framework/Manual Import’ and create a folder called ‘Youtube’. Under this folder create a menu item called ‘Import Videos’ from the template ‘/sitecore/templates/System/Menus/Menu item‘. The ‘Import Videos’ menu looks like below. The purpose of ‘Import Videos’ menu is to import only the video data.

Sitecore Media Framework

Similar to the ‘Import Videos’ I added another menu called ‘Import Playlists’.

Sitecore Media Framework

Media Framework ribbon shows all our Import button and menus now.

Sitecore Media Framework

The menus are not functional until we add the commands in the configuration file and add some code. Here is a snippet of the configuration file to make the ‘Import All’ working. I will discuss this in more detail in the later post.

 <configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
 <sitecore>
 <commands>
 <command name="mediaFramework:ManualImport:Youtube" type="Sitecore.MediaFramework.Youtube.Commands.YoutubeImportContent,Sitecore.MediaFramework.Youtube"/>
 </commands>

 <mediaFramework>
 <mediaImport>
 <importExecuters>
 <add name="import_youtube_videos" type="Sitecore.MediaFramework.Youtube.Import.VideoImporter, Sitecore.MediaFramework.Youtube"/>
 </importExecuters>
 </mediaImport>
 <scopeExecuteConfigurations>
 <add name="import_youtube_content" type="Sitecore.MediaFramework.Scopes.ScopeExecuteConfiguration, Sitecore.MediaFramework">
 <accountTemplate>{EA90BBD7-6A6D-417A-85E3-81908BEDE4A0}</accountTemplate>
 <scope hint="list">
 <name>import_youtube_videos</name>
 </scope>
 </add>
 </scopeExecuteConfigurations>
 </mediaFramework>
 </sitecore>
</configuration>

That’s all for today. In the next post we will talk about how to create templates for Youtube video account, account settings configuration, Creation of Video Players and many more.

Advertisements

About Himadri Chakrabarti

I am a software developer architect and a Sitecore MVP. My professional interest is everything and anything related to Software Architecture, .NET, Sitecore, Node.js, NoSQL etc. Outside of my profession, I am a hobbyist photographer. Link to my photography site http://himadriphotography.com/
This entry was posted in Media Framework, Sitecore and tagged , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s