Friday, October 3, 2008

Argh... Silverlight 2 Server Side Scripting Support

Ok, you got very happy with announcement of Silverlight 2 supports WMS server side scripting (SMIL), you implement it and then ! BUUM :)

From documentation, as always I've read it only after series of prototypes to find out where it hurts:

Seeking behavior/ CanSeek: Seeking is not supported for either on-demand or broadcast streams in Silverlight 2. CanSeek always returns false if given a SSPL.


Of course this isn't actually true, since Silverlight CAN seek, and DO seek, but only in some scenarios, like playing OnDemand content trough Directory publishing points.

But it can't do more complex senarious, like seeking SMIL generated playlists.

To fix this, you need to introduce some of you custom logic behind, and generate scripts on Silverlight 2 GUI demand dynamically, with server side seeking emulation, using clipBegin SMIL tag.

And then, you find out that it still can't play SMILs with archives from directory publishing points and clipBegin tag. Then you move to direct archive broadcast, not trough Directory Publishing point (this hurts in 10+ servers scenarious, just to configure, it takes whole day).

And then you find out that Silverlight 2 downloader can't handle URLs with \ in path like:

http://YourWMSServer/DynamicPubPoint?StreamFileSource=C:\MyFolder\MyVideo.wmv

Where DynamicPubPoint is your httpd dynamic ASP behind, used for dymaic SMIL generation.

And then, finally, you introduce custom escape sequence, and change url to something like:
http://YourWMSServer/DynamicPubPoint?StreamFileSource=C:_MyFolder_MyVideo.wmv

And IT WORKS :)

Of course, this escape sequence problem is needed only in managed Silverlight. Javascript based silverlight throws exception, but actually playes the stream.

And they said they support Server Side Playlists - my ass they do.