Configuration Files for Silverlight HVP

MiniTutorialLogo

SLHvpLogo
This mini-tutorial is part of the Silverlight HyperVideo Project documentation.

Taking Risks

One of the great pleasures, and total terrors of documenting this open-source application is that occasionally I have to offer up some half-baked ideas that risk displaying how little I know about a particular topic, but which are necessary to generate discussion. Caveat: this is such an entry.  I could have put this into the project documentation but I saw an opportunity to widen the audience on a topic that is important to Silverlight Programmers, even if not part of Silverlight itself.

Goal

We want the modules in the Silverlight HVP to be as flexibile as possible. Towards that end we’ve adopted two strategies:

  • Using the Managed Extensibility Framework (MEF) to make every module composable and extensible.
  • Using XML files to provide Just In Time configuration for each module.

XML Schemas

It will greatly simplify everyone’s work if we have agreed upon schemas, at least for the configuration files we know about:

  • slhvpInit.xml – initialize the application
  • slhvpTOC.xml – create a table of contents for a video
  • slhvpLinks.xml – establish which links will appear while a video runs and what to do when the user clicks on each

As a necessary first step, I’ve sketched out examples of slhvpTOC.xml and slhvpLinks.xml – these are not intended to be complete, but to generate discussion. They are posted here as a way to invite more folks into that discussion.

slhvpTOC.xml (draft example)

   1: <?xml version="1.0" encoding="utf-8"?>

   2: <ConfigFile Name="TOC Configuration File"

   3:             Guid="687DA074-8F94-43a9-AC23-46DF823F8A65"

   4:             xmlns=http://slhvp.com/TOC>

   5:   <ConfigurationMetaData>

   6:     <Version>0.0.1</Version>

   7:     <Purpose Summary="Create a Table of Contents for a video" />

   8:     <![CDATA[

   9:     This configuration file is used to create the table of contents. The topics are listed as links, which cause

  10:   the video to seek forward or backward to the designated topic.

  11:     ]]>

  12:     <Module Name="slHVP Standard TOC Module version 0.1"

  13:             Guid="D3E2AC2B-FD34-40b4-BC42-308F7956C7D9" />

  14:     <CreatedDate Format="AmericanShort" Date="01/01/2001" />

  15:     <Conditions>

  16:       <Condition Name="Advanced"

  17:                  Value="True" />

  18:     </Conditions>

  19:   </ConfigurationMetaData>

  20:

  21:   <ConfigurationData>

  22:   <TOCEntries>

  23:     <TOC>

  24:       <Type> TOC </Type>

  25:       <SeekTo>

  26:         <SeekToTime>00:00:10:000</SeekToTime>

  27:       </SeekTo>

  28:       <Text> Introduction </Text>

  29:     </TOC>

  30:     <TOC>

  31:       <Type> TOC </Type>

  32:       <SeekTo>

  33:         <!-- Seek directly to an injected or existing marker -->

  34:         <SeekToMarker ID="LINQ" />

  35:       </SeekTo>

  36:       <Text> Introduction to LinQ </Text>

  37:     </TOC>

  38:     <TOC>

  39:       <Type> TOC </Type>

  40:       <SeekTo>

  41:         <SeekToTime>00:20:10:010</SeekToTime>

  42:       </SeekTo>

  43:       <Text> MVVM </Text>

  44:       <!-- Designate that this entry in toc is only idsplayed if 

  45:       the Advanced condition has been set to true -->

  46:       <Visibility Condition="Advanced" RequiredValue="True" />

  47:     </TOC>

  48:   </TOCEntries>

  49:   </ConfigurationData>

  50: </ConfigFile>

  51:

The file consists of a header (lines 2-4) and two major sections – the meta-data (lines 5-19) and the listing of the (abridged) Table of Contents entries (lines 22 – 48). Notice that the final TOC entry (lines 38-47) is visible only if the condition “Advanced” is set to true, which it is in the Conditions section int eh meta-data (lines 15-18.

slhvpLinks.xml (draft)

   1: <?xml version="1.0" encoding="utf-8"?>

   2: <ConfigFile Name="Links Configuration File"

   3:             Guid="83ca650e-25ff-414d-adef-7aa790f9d858"

   4:             xmlns="http://slhvp.com/Links">

   5:   <ConfigurationMetaData>

   6:     <Version>0.0.1</Version>

   7:     <Purpose Summary="Link time to hyperlink to action" />

   8:     <![CDATA[

   9:     This configuration file is used to create linkage among an elapsed time in a How Do I video with

  10:     the text of a new link to display at that time and then with the action to take based on the new link being clicked.

  11:     ]]>

  12:     <Module Name="slHVP Standard Link Module version 0.1"

  13:             Guid="FB252D52-A603-4bf4-89C8-AA64E52D0343" />

  14:     <CreatedDate Format="AmericanShort" Date="01/01/2001" />

  15:     <Conditions />

  16:   </ConfigurationMetaData>

  17:

  18:   <ConfigurationData>

  19:   <Links>

  20:     <Link>

  21:       <Type> Hyperlink </Type>

  22:       <Time>

  23:         <!--Time format is hh:mm:ss:msmsms-->

  24:         <StartTime>00:00:00:000</StartTime>

  25:         <!--Undefined end time - visible to end of video-->

  26:         <EndTime>0</EndTime>

  27:       </Time>

  28:       <Text> About this video </Text>

  29:       <Action> WebPage </Action>

  30:       <URL> http://jliberty.com/aboutHyperlink.htm </URL>

  31:     </Link>

  32:     <Link>

  33:       <Type> Hyperlink </Type>

  34:       <Time>

  35:         <StartTime>00:05:11:010</StartTime>

  36:         <!--End time of 0 or missing end time both mean no end time, run to end-->

  37:       </Time>

  38:       <Text> What is Linq </Text>

  39:       <Action> Video </Action>

  40:       <URL> http://silverlight.net/learn/video#103 </URL>

  41:     </Link>

  42:     <Link>

  43:       <Type> Hyperlink </Type>

  44:       <Time>

  45:         <StartTime>00:12:00:110</StartTime>

  46:       </Time>

  47:       <Text> Linq Programming Animation </Text>

  48:       <!-- video pauses and is replaced by animation frame -->

  49:       <Action> Animation </Action>

  50:       <!--Required either a URL or a guid to a frame-->

  51:       <GUID>

  52:         E40D045A-4AC4-4ea9-8501-58F0E0407F61

  53:       </GUID>

  54:     </Link>

  55:   </Links>

  56:   </ConfigurationData>

  57: </ConfigFile>

  58:

You can see that this format is quite similar to the TOC format, and one open question is whether we need an inclusive schema.

In this file, each Link has a type, where some of the possible values are

  • HyperLink (link to a URL)
  • Animation (link to a frame that supports animation
  • Text (link to a frame that displays non-html text)

Purpose of this posting

To reiterate, briefly, I have two goals with this posting:

  1. Generate discussion about what needs to be in the configuration files and whether this is a reasonable starting point and
  2. Follow through on the implications of my thinking about markers, links, etc.

Note that this topic is also under discussion here which is a great place to continue the discussion.

Share

About Jesse Liberty

Jesse Liberty is an independent consultant and programmer with three decades of experience writing and delivering software projects. He is the author of 2 dozen books and multiple Pluralsight courses, and has been a Senior Technical Evangelist for Microsoft, a Distinguished Software Engineer for AT&T, a VP for Information Services for Citibank and a Software Architect for PBS. He is a Xamarin Certified Mobile Developer and a Xamarin MVP, Microsoft MVP and Telerik MVP.
This entry was posted in HyperVideo Player, Mini-Tutorial, Patterns & Skills and tagged , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published.