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.

Continue reading

Posted in HyperVideo Player, Mini-Tutorial, Patterns & Skills | Tagged , , | Comments Off on Configuration Files for Silverlight HVP

Polling Video – A Viable sub-second alternative?

SLHvpLogo

An interesting suggestion was made with regard to my intended use of embedded “heartbeat” markers.  Mike Loynd (WL) referred me to this fascinating article by John Deutscher (PM for IIS Media).  That caused me to experiment with the following code in the HVP Silverlight Video Player,

public partial class Player : Page

{

  private readonly DispatcherTimer timer;

 

  public Player()

  {

    InitializeComponent();

    timer = new DispatcherTimer { Interval = new TimeSpan( 500 ) };

    timer.Tick += new EventHandler( timer_Tick );

    timer.Start();

  }

 

  void timer_Tick(object sender, EventArgs e)

  {

    var position = CoreMedia.Position;

    var minutes = position.Minutes;

    var seconds = position.Seconds;

    var milliseconds = position.Milliseconds;

    TopPlaceHolder.Content = 

       string.Format("{0:d2}:{1:d2}:{2:d4}", 

       minutes, seconds, milliseconds);  

  }

 

 

Essentially, every 1/2 second I’m asking the streaming video for its position, which is returned as a timespan. Here’s a (cropped) snapshot of the player in action:

Timer

The advantages of this approach are:

  • No markers need be embedded, all the information about the TOC, links, etc, can be encapsulated in an xml file or database, and be applied to any video
  • Granularity (do care about 1/2 second intervals or 5 second intervals?) can be adjusted based on the media, the bandwidth, etc.
  • Adding links and other HyperVideo information can be applied to any video without having to modify the video in any way.

The key question is how often one can poll without noticeably affecting performance, but this does show a great deal of promise. More on this very soon.

The code for this is now checked into the Silverlight HyperVideo Project  as build 53344

Posted in z Silverlight Archives | 1 Comment

Silverlight HVP Design, Refinements

MiniTutorialLogo

SLHvpLogo

Design Update 

This was posted on Dec. 29 and updated on Dec. 30. The significant changes are to the Configuration and Marker Events sections

This blog post extends the  previous post in which I discussed the IMarkerEventHandler interface and how it might be implemented.

Readers and Frames

The design calls for one or more Pages each of which may have any number of UI modules. The default case is to have a TableOfContents module, a LinksDisplay module and a Reader module.

A Reader houses Frames where a Frame is a set of controls.  The Reader knows which frame to create and manages the lifetime of Frames.

A given frame has a known set of controls. For example, Frame-Type-1 might house the  HVP-extended version of the Silverlight Media Framework player (as described in this blog post) and Frame-Type-2 might display an html page and have a set of navigation controls.   (More on readers and Frames early in January)

Configuration

We anticipate using XML configuration files (delivered via WCF RIA Services and instantiated by MEF into a collection of business objects that for now I’ll call  HVPLayout. 

Marker Events

The meaning and actions to be taken by a Frame in response to hitting a marker in the video will be managed by the IMarkerEventHandler (MEH) implementing class. as described in the previous post mentioned earlier. 

One approach is to have the Marker Event Handler class  own a collection of HVPMarkerEvent business objects, each representing one association between a marker, its time, its type (link, etc.) and whatever other information the MEH class will need to raise the appropriate event.  A second approach, and one that is gaining a lot of traction, is to bring in the EventAggregator from Prism.

Supporting Legacy Videos

The Silverlight HyperVideo Player will continue to support existing videos that do not have markers nor our config files by having a default layout in which there is a reader that takes up the entire page, and that reader contains a Frame that itself contains nothing but our extension to the SMF player.

Other Technologies

We are actively looking at when using an IoC (Inversion of Control) container such as Ninject would provide services that are not otherwise available. For now, we believe MEF will provide the Container services, configuration and interaction with Unit Test that we need.

Posted in z Silverlight Archives | Tagged , | Comments Off on Silverlight HVP Design, Refinements

Silverlight HVP Design Update

 

SLHvpLogo
This blog post is part of the documentation for the Silverlight HyperVideo Player Open Source Project

Design Change:

  1. Create an Interface: IMarkerEventHandler
  2. Optionally derive a base class MarkerEventHandler that implements the interface
  3. Instantiate MarkerEventHandler classes that are decoupled from the HyperVideo player

This change is designed to decouple the response to markers in a video from the other responsibilities of the Silverlight HyperVideo player.

IMEH 
[Click on image for full size]

Each MEH encapsulates a strategy for responding to markers.

Here are four examples of how a MEH might interact with markers.

  • Heartbeat markers – every n seconds, used as lookups into a data source to see if there is an action at that time
  • Synchronization markers – at known times, used to resynchronize, but the logic for what happens at a given time is independent of any marker event
  • Meaningful Markers  – traditional use of a marker that tells you what time it was raised and identifies what the marker indicates (tied to an event in the video)
  • Null marker – the MEH is responsible for whatever we choose but does not depend on markers in the video

There is, potentially, more than one way to have an MEH associated with a HyperVideo player:

Option 1: The HVP will have-a MarkerHandler. As the video is played, if a marker is encountered the HVP will invoke a method on the contained MarkerHandler.

Option 2: (Looser coupled). The application will instantiate a player and a MEH object and when the player encounters a marker it will raise an event to which the MEH will subscribe. If the MEH needs to have the player take an action (e.g., pause or resume) the MEH will fire an event to which the player will subscribe.

These ideas are not fully developed but are thought through enough to move forward and with luck, sufficiently flexible to be easily modified as design emerges.

 

Details about the Silverlight HyperVideo Player Project can be found at our CodePlex Site and information on joining the Development effort can be found on the Developer Page within the project documentation.

Posted in HyperVideo Player | Tagged | 1 Comment

Being a writer, and having an editor. A Short Rant.

I have been incredibly lucky; the editors I’ve worked with have been terrific. O’Reilly, for example, spends a lot of time on editing. And they interpret the term editing correctly and broadly: everything from copyediting to technical editing to just making sure that what you’ve written is clear, correct and concise.

I should add that my current development editor, one Brian MacDonald, is among the best I’ve ever worked with; he has incredible patience, intellect, perspicacity, proportion, tact… you know, he’s a mensch.

So, with apologies to him and others, here is my rant on topics I run into as an author…

<rant>

Outliars

 

Whence the rule that any heading must have at least two sub-heads? Silly, absurd and a prescriptivist straight-jacket.

Animals

  Mammals

    Dogs

    Other Animals

  Marsupials

    Why they are funny looking

Plants

I simply reject as overly constraining the notion that “Why they are funny looking” must either have a sibling (“why editors are marsupials?”) or be merged into the parent (“Marsupials,  and why editors are funny looking”). 

Let me Make A Preposition To You

There are a number of dopey rules about prepositions that arise out of an insipid and false attempt to Latinize our Germanic language. The silliest is the “never end a sentence with a preposition”

No native-English speaking person would ever say  “What movie was it to which we went?”  You and I and everyone else who speaks the language would say “What movie did we go to?”

Infinitely Annoying

Again, arising from Latin but having nothing to do with English, came the pseudo-rule that you should never split the infinitive.  Besides causing you to stupidly put the verb in the wrong place (stupidly to put?) such a rule would not allow Captain Kirk to bravely go anywhere.

Are you more careful than she?

If I fell

I’ll just quote from John Lennon

If I give my heart to you

I must be sure

From the very start

That you would love me more than her

Can you quite imagine him writing “love me more than she”  ???

“Knock Knock”

“Who’s there?”

“I”

“eye?”

“Aye, it’s me

    – Liberty 2009

Off To A Bad Start

There is no excuse for thinking that you can’t start a sentence with “There is.”  And I should add that I think it is fine to start a sentence with “and.” But not just and, even but.

A Singular Notion

While none of us is perfect, none of us are ever going to remember to use the singular because it doesn’t make sense much of the time.  Not everyone is annoyed when they see they used with a singular antecedent. If you are one who is, I recommend the brilliant paper written by Geoffry K. Pullman

Which Witch Created That Rule?

I’d almost given up on fighting the rule which is most often of concern to editors trained that one must never use  “which” to introduce a restrictive clause. But then I learned that this rule was invented out of whole cloth by the completely untrained  Strunk (of the infamous Strunk and White). It turns out, to his embarrassment, that Strunk violated this arbitrary caprice three times in Elements of Style.

 

</rant>

Posted in z Silverlight Archives | 1 Comment

Information for Silverlight HVP Developers…

Information for current and interested developers for the Silverlight HVP project has been consolidated, extended and updated on the new Developer’s Page.

</msg>

Posted in HyperVideo Player | Tagged | Comments Off on Information for Silverlight HVP Developers…

A Silverlight HVP Update

SLHvpLogo

A Silverlight HVP Update

I’m extremely pleased to report that a start-up e-learning company (currently code-named WL) has committed approximately 100 hours / week of development time by four of their world-class Silverlight developers,  from now through February. All of the work they do will be fully integrated into the Silverlight HVP and released under the Ms-PL.

We are currently working on the feature list for Version 1, but the very good news is that virtually all of the features they are most interested in,  are either on the feature list already (either for V1 or beyond) or are completely consistent with the idea and spirit of the Silverlight HyperVideo Player

Among the features under consideration for V1 (March, 2010) are:

Architecture

  • Implementing a fully modular architecture
  • MEF from Day 1
  • Creating a Viewer that will hold Frames, where Frames are named sets of controls.
  • One example of a Frame will be a player derived from the SMF
  • Another example of a Frame will be an HTML viewer for displaying web links
  • A third example of a Frame will probably display animations
  • A Table of Contents module that will house a class derived from Tree control
  • A Links module that will hold the links associated with a video
  • Features

    • Out of Browser capabilities
    • Identification, Authentication and Authorization
    • Local Storage
    • Skinning with Templates
    • Authoring Tools

    Interactivity & Collaboration

    • Multicasting
    • Interactive Response
    • Real-time communication

    Standards And Protocols

    • Extension of the protocols for encapsulating the linkage between a marker in a video and the actions to take (e.g., pausing the video and displaying additional information) to conform to emerging or existing industry standards.
    • Integration with existing or creation of new Experience (EMS) and Learning Management Systems (LMS) and other analytics
    • SCORM compatibility
    • Potential integration with Microsoft Semblio and related projects

    Details about WL will be available early in 2010, but we are already beginning the work of creating the specifications, and coding will start will start next week (“you start coding, I’ll go find out what they want…”)

    Core Technologies

    The Silverlight HVP is now committed to the following technologies and practices:

    Help Wanted!

    • Contributing Developers
    • QA
    • Project Management (assist with oversight of the project)
    • Software Architect to assist with creating units of work and “just-enough specification”

    Please see Contributing To The Project in the HVP CodePlex documentation.

    Unconfirmed and Fully Deniable Rumors

    We are discussing obtaining extensive User Interface support with a world-class web design organization that has done some incredibly creative and closely related work. More on this as soon as possible.

    Posted in z Silverlight Archives | Tagged | Comments Off on A Silverlight HVP Update

    4 Calendars & Plans for 2010 / 5770

    I live, more or less consciously. in the rhythm of four calendars; three of which are very closely aligned:

    • The Gregorian Calendar (Today is 12/20/2009)
    • The Jewish Calendar (Today is 3rd of Tevet, 5770 )
    • The Microsoft Fiscal Year (Today is about 3.5 months into my yearly commitments)
    • The Academic Calendar (while my kids are in school)

    Fortunately, the last three more or less align, so I tend to think in terms of two New Year’s – two times a year to revisit what I’m doing and recommit: early September and about now.

    Projects for Jan 1 – end of Microsoft FY

    Silverlight HVP

    This is a core commitment, both in terms of my commitments to Microsoft and to the community. It is also a labor of love – what could be more fund than bringing together a project that lets me work an application with potentially high value that also spins out learning material (mini-tutorials, tutorials, videos, etc.)  The state of this project as of Dec 19, 09, can be found here.

    Expect to see updates at least weekly and “releases” every other Wednesday as documented here.

    Tutorials & Mini-tutorials

    The Mini-Tutorials will focus on the following areas

    The Tutorials will often be roll-ups and integration of various mini-tutorials and videos. Expect to see mini-tutorials about weekly, and Tutorials about every six weeks.

    Blogging

    The blog will focus on the following topics (leavened now and again with other things as they occur to me):

    • Mini- Tutorials
    • HVP Status Updates
    • Geek Profiles
    • Twitter – Micro-blogging.

    Videos

    Videos will focus strongly on Silverlight 4 and MEF, SMF and WCF RIA Services

    Conferences & Presentations

    • Plans
    • Trip Reports
    Posted in z Silverlight Archives | Tagged | Comments Off on 4 Calendars & Plans for 2010 / 5770

    HVP Core Scaffolding and Updated News

     

    MiniTutorialLogo

    This article is part of the Mini-Tutorial Series

    slhvplogo50pct

    This article is part of the Silverlight HVP Documentation

     

    The State of the Silverlight HVP Project

     

    • LeanKit Kanban has licensed us under their Open Source provisions, and has gone the extra mile to give virtually unlimited licenses.
    • An e-learning start up is negotiating to contribute approximately 20+ hours per week for up to 3 months of free programmer time under the Ms-PL open source license as they are interested in using the HyperVideo player in their own project. This is not finalized, but is very exciting.
    • Six independent programmers have volunteered to contribute their time and effort to the project.
    • Discussions are under way with three different groups that may provide UX expertise.
    • Numerous groups inside and outside of Microsoft have expressed interest in participating in, or using the SilverlightHVP – announcements to follow as this firms up.

     Help Wanted: QA Testers – if interested, please contact me.

    Today:

    Today I checked in the scaffolding for the Silverlight HVP player, tearing out the test code in the player derived from the Silverlight Media Framework and adding ListBoxes for the Table of Contents and the Links. I also added splitters to allow the user to resize the windows, and a top and bottom row (in case we need it!)

    slhvp-12-19 

    Steps

    The steps to making these changes were to open the template in Blend and create a copy named SLHvpNoToggleButton in the same file (SlhvpPlayer.xaml).

    I took out all the changes we added previously, and then added 5 columns and 3 rows, placing the player in the second row, third column.

    In the first column (second row) I added  a list box to hold the Table of Contents, and hard wired some ListBoxEntry items as you can see in the image.

    In the fifth (far right) column (second row) I added a second list box in the same way, to represent the links.

    The second and fourth columns in the second row hold splitters to enable the user to resize the columns.

    All of this is checked-in to source code control as build 52656 available on the Silverlight HVP CodePlex Site under the Source Code tab.

      

      

      

      

      

      

      

      

    Project Management Tasks

    In addition to providing a more solid starting point, this completes a number of tasks. Here is the state of the project as represented on our KanBan board:

    KanBan-12-19-1330

    The newly completed tasks are under Ready To Deploy.  White indicates a task, Green a Feature, Light Blue an Improvement.

    Ready for Dev. indicates items from the backlog that have been pulled forward, waiting for a developer to take ownership. Participating developers start out as Patch Programmers (there are currently six), information on contributing is here

    Release Schedule

    As you may know, as of now, I’ve committed to two milestone releases.

    Current plans are to release an approved version every other Wednesday beginning December 23. Source code is continually available.

     

     

    Posted in z Silverlight Archives | Tagged | Comments Off on HVP Core Scaffolding and Updated News

    Extending the SMF for the HVP

    In a radical and terrifying experiment, I’m going to document what happens when I try to extend the Silverlight Media Framework (SMF) for the Silverlight HyperVideo Player as I do it.

    MiniTutorialLogo

    This article is part of the Mini-Tutorial Series

    SLHvpLogo

    This article is part of the Silverlight HVP Documentation

     

    My plan is to follow along with this video (part of the SMF documentation) and adapt it to extending the SMF player already embedded in the HVP source code so as to add a pseudo-links window to the right of the video player. 

    Note: Click on images below, to see full size.

    Adding the SMF Player

    1. I begin by checking out (updating) my copy of the Silverlight HVP source code (available here)SMFDlls to version 52279

    2. Opened the project and added a new view named Player

    3. Added the DLLs required by the SMF (see Image)

    4. Added the namespace for the Media Player to the top of the Player.xaml file

    5. Added the code to create a player that begins playing immediately, using the URL provided by the SMF project, as shown in the code block:

     

    xmlns:p="clr-namespace:Microsoft.SilverlightMediaFramework.Player;

       assembly=Microsoft.SilverlightMediaFramework.Player"

    <p:Player>

       <p:CoreSmoothStreamingMediaElement AutoPlay="True"

           SmoothStreamingSource="http://video3..../Manifest" />

    </p:Player>

     

     

     

    6. Added a block to MainPage.xaml to navigate to the new page:

    <HyperlinkButton x:Name="PlayerLink"

                     Style="{StaticResource LinkStyle}"

                     NavigateUri="/Player"

                     TargetName="ContentFrame"

                     Content="{Binding Path=ApplicationStrings.PlayerPageTitle, 

                            Source={StaticResource ResourceWrapper}}" />

    7. Opened Assets –> Resources –> ApplicationStrings.resx and added a string for the new page title and fixed up any detritus from previous updates.

    While I was at it, I removed the link to home.xaml and set About.xaml as the default page. Running the application brings you to the About page, clicking on the player page brings up the SMF player and starts the movie.

    Adding A Custom Player

    I’m now ready to begin the process covered in the SMF video Extending The Video Player

    Create a new class: SlhvpPlayer and add these attributes:

    [TemplatePart(Name="TOCToggle", Type=typeof(ButtonBase))]

    [TemplateVisualState(Name="ShowTOC", GroupName = "TOCVisibility")]

    [TemplateVisualState(Name="HideTOC", GroupName = "TOCVisibility")]

    Indicating that the class will have a template part of type Button that will toggle between the Show and Hide visual states.

    The new class extends Player, and thus needs a using statement:

    using Microsoft.SilverlightMediaFramework.Player;

    We’ll also give the class a private member variable to track whether the Table of Contents (toc) is visible,

    private bool tocIsVisible;

     

     

    The custom class also overrides OnApplyTemplate, calling the base method but retrieving a reference to the Button that (will be) in the templated player and setting a handler for the click event on that button. The click event toggles between the two visual states.

    public override void OnApplyTemplate()

    {

      base.OnApplyTemplate();

      var btn = GetTemplateChild("TOCToggle") as ButtonBase;

      if (btn != null)

      {

        btn.Click += BtnClick;

      }

    }

     

    private void BtnClick(object sender, RoutedEventArgs e)

    {

      tocIsVisible = !tocIsVisible;

      string whichState = tocIsVisible ? "ShowTOC" : "HideTOC";

      VisualStateManager.GoToState(this, whichState, true);

    }

     

    Returning to the Player.xaml file, you’ll need an alias to the project itself,

    xmlns:hvp="clr-namespace:SilverlightHVP"

     

    That will allow you to swap out the SMF player for your derived player:

    <hvp:SlhvpPlayer>

       <p:CoreSmoothStreamingMediaElement AutoPlay="True"

           SmoothStreamingSource="http://video3.../Manifest" />

    </hvp:SlhvpPlayer>

     

    Templating in Blend

    All of this is well and good, but nothing will change with the new player unless we open the project in Blend and set some form of behavior for the two Visual States we created. I’ll start by checking in what I have so far (always nice to have a working copy checked in). [Version 52355].

    Next Best Practice: I’ll stop for the night and get a good night’s sleep!

    — Next Day —

    My goal now is to modify the template to have a place for the links to the right of the video, and a button at the bottom that will make this appear and disappear.

    Adding the pseudo-links list

    Returning to the project, I’ll open it in Blend, double click on Player.xaml file and right click on the Player in Objects and Timeline and click on Edit Template –> Copy.  I’ve named the template SlhvpPlayerToggleButtonTemplate. I’ll select the radio button to place the new template into a Resource dictionary and name that dictionary SLHvpPlayer.xaml.

    Click on the layout controls in the toolbox and choose StackPanel. Double click to add a StackPanel to the template, and then right click on the StackPanel in the Objects and Timeline window and use the Order context menu to send it to the back. In the properties window, set its size to Auto/Auto and both alignments to Stretch. Finally, set its orientation to horizontal.

    Click on the  MediaPresenterElement (which displays the video) and drag and drop it onto the StackPanel, causing it to be a child of the StackPanel. Set its width to Auto.

    To stand in for the links, add a TextBlock to the StackPanel, Set its font to Goergia, 12 and its vertical alignment to center, horizontal alignment to stretch and its height and width to auto.

    Adding the Toggle Button

    In the Ojbects and Timeline window, click on the ControllerContainer, and then in properties set its height to Auto. Expand the Layout section and click on the elipses buttonRowDefinition for the RowDefinition collection (as shown, cropped) . Add two rows to the ControllerContainer, setting the height of each to Auto.

    In Objects and TimeLine click on the ControllerContainer to make it the selected object and then in the toolbox double click on the button, causing it to be added to the ControllerContainer. Click on the button in either Objects and Timeline or the designer and turn to the properties window where you can set the button’s ColumnSpan to 1, its Row to 1 (second row) and its margins to 0. Set its content to “Toggle.” 

    We want the name of the button to match the name we set up in the TemplatePart attribute for the derived player: TOCToggle.

    Toggling the View State

    Click on the States tab to open the States window and notice that the TOCVisibility states are available for you to modify. 

    CustomStatesClick on the ListBox and then on ShowTOC and set visibility to Visible. Then click on HideTOC and set visibility to collapsed. Finally, set the default transition time to 0.3s.  

     

     

    Click on the ShowTOC state and then click on the TextBox that holds our pseudo-links and set its Visibility property to visible. Then click on the red circle in the design frame to stop recording state changes.  Repeat for HideTOC setting Visibility to collapsed, and then save the project.

    Return to Visual Studio, click Yes to accept the changes that were made by Expression Blend and run the application. Click on the Player button and the movie starts playing. Click the toggle button to display or hide the “list of links”

    RunningPlayer

     

     

    Architectural  Note

    The goal will be to decouple the Links window, the Table of Contents window and the Player, through MEF, so that we can swap in alternative (or newer) versions of each without breaking the others. Time and resources will determine whether that is done in the first version or immediately afterwards

     

    There is much more to be done, but we’ve extended the SMF player within a view of the HVP project and it is quite clear that we can add both a links and a TOC window based on this work.  This is checked in as 52454

    Posted in z Silverlight Archives | Tagged | 5 Comments

    Contributing to the SL HVP

    [ Update:  Latest information on contributing now in the Silverlight HVP CodePlex documentation.]

    Help Wanted: Project Management

    The project would benefit tremendously by having someone in addition to me managing and coordinating the contributors, the trunk and branches of the source code and the evolving specifications for the core-project and any extensions.

     

    Posted in z Silverlight Archives | Tagged | Comments Off on Contributing to the SL HVP

    Best SF Books of All Time

    Someone just asked me my favorite SF books, and while creating such a list is almost absurd, nonetheless, it being the end of the year, here’s my top 10:

    Posted in z Silverlight Archives | Comments Off on Best SF Books of All Time