This article is more than 1 year old

Build a Silverlight media player

Going for gold

First remove the Default.html, Web.Config, Default.html.js and Silverlight.js files. The silverlight.js file is no longer required - this functionality is replaced by Silverlight Streaming.

Add some JavaScript that can be called when the application loads - add a file called Player.js as follows (the createDelegate snippet is just some glue that used to come from Silverlight.js).

Silverlight.createDelegate = function(instance, method) {
    return function() {
    return method.apply(instance, arguments);
    }
}

function onLoad(sender, context, source)
{
        var scene = new ChildOfMine.Page();
        scene.handleLoad(sender, context, source);
}

Then create a manifest.xml file that loads the XAML and calls the onLoad function defined above.

<SilverlightApp>
        <version>1.0</version> 
        <source>Page.xaml</source>
                <onLoad>onLoad</onLoad> 
        <jsOrder>
                <js>Page.xaml.js</js> 
                <js>Player.js</js> 
        </jsOrder>
</SilverlightApp>

You can now ZIP up the files and upload to Silverlight Streaming - a process described in detail in my earlier article.

To see the application running using the Silverlight Streaming IFRAME invoker click on this link.

Wrapping it up

Traditionally graphic designers use a tool like Photoshop then "throw their design over the wall" to developers who are responsible for cutting the graphics into the application. The design very rarely works exactly as intended and considerable rework is required if the design changes. The combination of Expression and Visual Studio offers a way to close the gap between the two camps.®

Thanks to Helen Yousaf for permission to use her copyright material in this article.

Rob Blackwell is director of R&D for Active Web Solutions who worked with the Royal National Lifeboat Institute (RNLI) to build its award winning Sea Safety tracking system. You can keep up with Rob here.

More about

TIP US OFF

Send us news


Other stories you might like