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 flexible 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)

<?xml version="1.0" encoding="utf-8"?>
<ConfigFile Name="TOC Configuration File" 
            Guid="687DA074-8F94-43a9-AC23-46DF823F8A65"  
            xmlns=http://slhvp.com/TOC>
  <ConfigurationMetaData>
    <Version>0.0.1</Version>
    <Purpose Summary="Create a Table of Contents for a video" />
    <![CDATA[
    This configuration file is used to create the table of contents. The topics are listed as links, which cause
   the video to seek forward or backward to the designated topic.
     ]]>
     <Module Name="slHVP Standard TOC Module version 0.1" 
             Guid="D3E2AC2B-FD34-40b4-BC42-308F7956C7D9" />
     <CreatedDate Format="AmericanShort" Date="01/01/2001" />
     <Conditions>
       <Condition Name="Advanced"
                  Value="True" />
     </Conditions>
   </ConfigurationMetaData>
  
   <ConfigurationData>
   <TOCEntries>
     <TOC>
       <Type> TOC </Type>
       <SeekTo>
         <SeekToTime>00:00:10:000</SeekToTime>
       </SeekTo>
       <Text> Introduction </Text>
     </TOC>
     <TOC>
       <Type> TOC </Type>
       <SeekTo>
         <!-- Seek directly to an injected or existing marker -->
         <SeekToMarker ID="LINQ" />
       </SeekTo>
       <Text> Introduction to LinQ </Text>
     </TOC>
     <TOC>
       <Type> TOC </Type>
       <SeekTo>
         <SeekToTime>00:20:10:010</SeekToTime>
       </SeekTo>
       <Text> MVVM </Text>
       <!-- Designate that this entry in toc is only idsplayed if 
       the Advanced condition has been set to true -->
       <Visibility Condition="Advanced" RequiredValue="True" />
     </TOC>
   </TOCEntries>
   </ConfigurationData>
 </ConfigFile>
  

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)

<?xml version="1.0" encoding="utf-8"?>
<ConfigFile Name="Links Configuration File" 
            Guid="83ca650e-25ff-414d-adef-7aa790f9d858"  
            xmlns="http://slhvp.com/Links">
  <ConfigurationMetaData>
    <Version>0.0.1</Version>
    <Purpose Summary="Link time to hyperlink to action" />
    <![CDATA[
    This configuration file is used to create linkage among an elapsed time in a How Do I video with
     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
     ]]>
     <Module Name="slHVP Standard Link Module version 0.1" 
             Guid="FB252D52-A603-4bf4-89C8-AA64E52D0343" />
     <CreatedDate Format="AmericanShort" Date="01/01/2001" />
     <Conditions />
   </ConfigurationMetaData>
  
   <ConfigurationData>
   <Links>
     <Link>
       <Type> Hyperlink </Type>
       <Time>
         <!--Time format is hh:mm:ss:msmsms-->
         <StartTime>00:00:00:000</StartTime>
         <!--Undefined end time - visible to end of video-->
         <EndTime>0</EndTime> 
       </Time>
       <Text> About this video </Text>
       <Action> WebPage </Action>
       <URL> http://jliberty.com/aboutHyperlink.htm </URL>
     </Link>
     <Link>
       <Type> Hyperlink </Type>
       <Time>
         <StartTime>00:05:11:010</StartTime>
         <!--End time of 0 or missing end time both mean no end time, run to end-->
       </Time>
       <Text> What is Linq </Text>
       <Action> Video </Action>
       <URL> http://silverlight.net/learn/video#103 </URL>
     </Link>
     <Link>
       <Type> Hyperlink </Type>
       <Time>
         <StartTime>00:12:00:110</StartTime>
       </Time>
       <Text> Linq Programming Animation </Text>
       <!-- video pauses and is replaced by animation frame -->
       <Action> Animation </Action>
       <!--Required either a URL or a guid to a frame-->
       <GUID>
         E40D045A-4AC4-4ea9-8501-58F0E0407F61
       </GUID>
     </Link>
   </Links>
    </ConfigurationData>
  </ConfigFile>
   

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.

This work is licensed under a Creative Commons license.

About Jesse Liberty

Jesse Liberty has three decades of experience writing and delivering software projects and is the author of 2 dozen books and a couple dozen online courses. His latest book, Building APIs with .NET will be released early in 2025. Liberty is a Senior SW Engineer for CNH and he was 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 Microsoft MVP.
This entry was posted in HyperVideo Player and tagged , . Bookmark the permalink.