December 31, 2015

My First DXA Module - JWPlayer - Steps by Step - Content Delivery

In last post, i detailed my experience on the CMS Part of the DXA module. In this post i will explain the CDA part

Visual Studio Solution: In Asp.net MVC each Module is separated by respective Area in the project. There are different ways to set your solution.

  • Use exiting DXA project and create required Area using Mvc ' Add Area..
  • You can use Visual studio extension for DXA to add, required files e.g Registration and Modle classes.
  • I find it easy to add above in existing DXA website, as it make me easy to debug and go ;)
Structure of  this plugin
so when we add new Area all the above folders, except Entity are automatically created along with web.config and JWPlayerAreaRegistration.cs file. 

Step by Step changes:
  1. Create Model class which will be used in the ViewModel and carry the data from component of JWPlayer Schema.
so here i have mapped all fields of schema to this ViewModel.

2.  Create view which will use above model and render the JWplayer Video. the name of view should match with one given in CT's metadata.

3. Update JWPlayerAreaRegisteration.cs so that it inherits  from  Sdl.Web.Mvc.Configuration.BaseAreaRegistration class
and overrides the RegisterAllViewModels method to register above view and view-model in view-registry. see below image , This is again very important step


 Now time to compile and test the module.

You will see following output.

You can see JWPlayer logo on top the the video. this is there as i have not used any valid key for it.

So we are done with the working DXA module step by step. 

Now time to bundle this module using Powershell scripts and submit to the Gallery where people can use and improve it. 

I will also send pull request on GIT to open source the code.  

I have listed out the features  for next version, which i will definitely work in 2016. Stay tuned for that.

Happy new year!!


No comments: