tbink

we currently drive DHTML in the browser via scriptcommands which run clientside javascript as they fire ( <script type="text/javascript" for="PlayerA" event="ScriptCommand(scType,Param)">... ) .... How do we do this with Silverlight We want to dynamically control a silverlight show similarly... and perhaps run DHTML in the areas of the browser page outside the silverlight object.

Re: Silverlight (formerly WPF/E) Developer Issues how listen for and use scriptcommands in Silverlight

Kevgor

Yes, sure you can. Your best best is to download the Silverlight SDK; it contains a number of samples, going from very simple "Hello Silverlight" type samples to more complex. You'll see how to drive the object model from script, either based on events fired from DHTML objects or from Silverlight objects.

Hope that helps

See you at Mix

Kevgor






Re: Silverlight (formerly WPF/E) Developer Issues how listen for and use scriptcommands in Silverlight

tbink

I've downloaded the SDK ( http://www.microsoft.com/downloads/details.aspx FamilyID=c744cbb8-d4d9-4bf9-ad5c-eef36e064911&displaylang=en ) and installed it but I'm not finding the samples you mentioned. I don't find any in FebCTPSamples.zip either. Am I looking in the right place

I guess that an example of text captioning during video playback is the example I'm looking for. I'm hoping that Media Player running within Silverlight (and so cross browser compatible) can listen for scriptcommands such that we can use those to drive Silverlight and DHTML. I don't see a "ScriptCommand" event listed in the SDK. However I see that capability mentioned in various places... most notably in an interview with one of the creators of the new Expression media encoder ( http://channel9.msdn.com/showpost.aspx postid=301419 ) .

Am I not thinking about this correctly

Thank you again for your helpful comments

Tom





Re: Silverlight (formerly WPF/E) Developer Issues how listen for and use scriptcommands in Silverlight

Kevgor

I guess maybe I don't know what a "ScriptCommand" is I thought initially you just wanted to source events from the media objects and handle them with javascript to drive the objects. Is a ScriptCommand a specialized construct

Kevgor






Re: Silverlight (formerly WPF/E) Developer Issues how listen for and use scriptcommands in Silverlight

tbink

For reference I'm looking at:

A scriptcommand is a type of metadata embedded in a Windows Media file. This is from the WindowsMedia Player SDK:

Commands can be embedded among the sounds and images of a Windows Media file or stream. The commands are a pair of Unicode strings associated with a designated time in the stream. When the stream reaches the time associated with the command, the Windows Media Player control sends a ScriptCommand event with two parameters. One parameter specifies the type of command being sent, and the other parameter specifies the command. The type of parameter is used to determine how the command parameter is processed. Any type of command can be embedded in a file or stream to be handled by the ScriptCommand event.

And, here's a link to WinMedia Player SDK on the subject: http://msdn2.microsoft.com/en-gb/library/aa389418.aspx

We use them extensively now in IE webpages to drive DHTML changes... something like this..

<script type="text/javascript" for="PlayerA" event="ScriptCommand(scType,Param)">
doScriptcommand(scType,Param);
</script>

I can see from the above links to MediaElement Class that its possible to listen for incoming scriptcommands in Silverlight via the MediaElement but my coding experience is javascript, xml, and browser BOMs ... so I'm not seeing how to accomplish this... I'm guessing that I'd use a StackPanel in a such a way that the scriptcommand routed event bubbles up to the MediaElement where it can be dealt with...

MediaPlayer.ScriptCommand Event : Occurs when a script command has been encountered within the media
here's the syntax shown:
<object ScriptCommand="EventHandler<MediaScriptCommandRoutedEventArgs>" .../>
and http://msdn2.microsoft.com/en-us/library/ms742550.aspx talks about how to route an event
I'm trying to figure out how to put it all together to do what used to be so simple

I heard/read about a simple example of this (mentioned in the video link above) to drive captioning... but I find no example on MSDN. Could you either write one here or point me to the right place

many thanks, again

tom





Re: Silverlight (formerly WPF/E) Developer Issues how listen for and use scriptcommands in Silverlight

m3taverse

According to the SilverLight SDK, these are the only events supported by the MediaElement Object :

Loaded, MouseMove, MouseEnter, MouseLeave, MouseLeftButtonDown, MouseLeftButtonUp, MediaOpened, MediaEnded, MediaFailed, DownloadProgressChanged, BufferingProgressChanged, CurrentStateChanged

This is VERY bad news. Please, we need the ScriptCommands Sad





Re: Silverlight (formerly WPF/E) Developer Issues how listen for and use scriptcommands in Silverlight

tbink

I'm pretty sure that you CAN use respond to ScriptCommands ... you just have to handle them differently because they are "routed events"

"Identifies the ScriptCommand routed event." ( http://msdn2.microsoft.com/en-us/library/ms611597.aspx )

then:

XAML Attribute Usage : <object ScriptCommand="EventHandler<MediaScriptCommandRoutedEventArgs>" .../> ( http://msdn2.microsoft.com/en-us/library/system.windows.controls.mediaelement.scriptcommand.aspx )

However this still doesn't tell me how to access the scriptcommand event ... I'm thinking that it might be as simple as <MediaElement ScriptCommand="javascript: doScriptCommand"></MediaElement> ... but that doesn't line up with the SDK. Please... if anyone knows the answer, reply on this thread.

Thank you

Tom






Re: Silverlight (formerly WPF/E) Developer Issues how listen for and use scriptcommands in Silverlight

m3taverse

tbink wrote:

I'm pretty sure that you CAN use respond to ScriptCommands ... you just have to handle them differently because they are "routed events"

"Identifies the ScriptCommand routed event." ( http://msdn2.microsoft.com/en-us/library/ms611597.aspx )

then:

XAML Attribute Usage : <object ScriptCommand="EventHandler<MediaScriptCommandRoutedEventArgs>" .../> ( http://msdn2.microsoft.com/en-us/library/system.windows.controls.mediaelement.scriptcommand.aspx )

However this still doesn't tell me how to access the scriptcommand event ... I'm thinking that it might be as simple as <MediaElement ScriptCommand="javascript: doScriptCommand"></MediaElement> ... but that doesn't line up with the SDK. Please... if anyone knows the answer, reply on this thread.

Thank you

Tom


I could be wrong, but you seem to mix up WPF with WPF/E. WPF does indeed support Script Commands. WPF/E, according to the SDK, does not.





Re: Silverlight (formerly WPF/E) Developer Issues how listen for and use scriptcommands in Silverlight

tbink

m3taverse wrote:

I could be wrong, but you seem to mix up WPF with WPF/E. WPF does indeed support Script Commands. WPF/E, according to the SDK, does not.

Given the limitation on my knowledge of languages (javascript/xml/Browser BOMs/Windows Media player&embedded... with limited Jscript.NET) I'm not sure that I understand the difference between WPF vs. WPF/E (though I understand that WPF is .NET3.0 and WPF/E extends that into the browser environment on the client I still think I should be able to recieve scriptcommand events... somehow) . What makes me believe that I can pick up scriptcommand events in Silverlight is the video I refer to above ( http://channel9.msdn.com/showpost.aspx postid=301419 ) ... at about 21min in to that video he talks about an NAB Silverlight demo he has built which demonstrates closed captioning using scriptcommands to drive it... both the timing and content (no doubt using TEXT/"my captions stuff" as the scType/Param pair). The question is then... what's the syntax in Silverlight XAML / javascript to implement it.

You'd think that MS would chime in here and provide a simple answer. Don't they monitor these forums at all





Re: Silverlight (formerly WPF/E) Developer Issues how listen for and use scriptcommands in Silverlight

m3taverse

I had not seen that yet, very interesting.. shows they will implement it by the looks of it. Or maybe they already have and I'm looking in the wrong place.

But you really have to look at the Silverlight SDK for all your documentation. The docs you find elsewhere regarding WPF or XAML may not apply to Silverlight.

Silverlight used to be called WPF/E, which is short for WPF Everywhere.

WPF is the new presentation technology that comes with .net 3.0, WPF/E is a subset of that functionality so it can run on multiple platforms.

I played around with creating a mediaplayer in WPF, and I had no issue at all getting the ScriptCommands. Then when I tried to do the same thing in Silverlight (WPF/E) I could not get it to work.





Re: Silverlight (formerly WPF/E) Developer Issues how listen for and use scriptcommands in Silverlight

tbink

m3taverse wrote:

I had not seen that yet, very interesting.. shows they will implement it by the looks of it. Or maybe they already have and I'm looking in the wrong place.

But you really have to look at the Silverlight SDK for all your documentation. The docs you find elsewhere regarding WPF or XAML may not apply to Silverlight.

I guess that's what I'd thought but was confused a little by my lack of knowledge. I'll bet that the Closed Caption demo that uses scriptcommands runs because .NET 3.0 is installed and its running in that envinronment. Perhaps... Sure would be great to get the definitive answer from MS Silverlight development.

m3taverse wrote:

Silverlight used to be called WPF/E, which is short for WPF Everywhere.

WPF is the new presentation technology that comes with .net 3.0, WPF/E is a subset of that functionality so it can run on multiple platforms.

I played around with creating a mediaplayer in WPF, and I had no issue at all getting the ScriptCommands. Then when I tried to do the same thing in Silverlight (WPF/E) I could not get it to work.

That is exactly what I was hoping was not true [sigh...] This is really a make or break issue for our multimedia development. We must be able to use the incoming stream to feed chapter indexing and scriptcommands. I don't see either supported in the Silverlight SDK... as opposed to the Windows Media SDK where all sorts of player functionality is exposed. Perhaps MS thinks its a security issue. HOWEVER, FLASH does support the equivalent of Chapter Indexing and ScriptCommands via embedded "Cue Points" and they go one better by providing an "event script" too (external to the media rather than embedded)... Here's from the relevant FLASH SDK section:

You can use several different kinds of cue points with Flash Video. You can use ActionScript to interact with cue points that you embed in an FLV file (when you create the FLV file), or that you create by using ActionScript.

Navigation cue points You embed navigation cue points in the FLV stream and FLV metadata packet when you encode the FLV file. You use navigation cue points to let users seek to a specified part of a file.

Event cue points You embed event cue points in the FLV stream and FLV metadata packet when you encode the FLV file. You can write code to handle the events that are triggered at specified points during FLV playback.

ActionScript cue points External cue points that you create by using ActionScript code. You can write code to trigger these cue points in relation to the video's playback. These cue points are less accurate than embedded cue points (up to a tenth of a second), because the video player tracks them separately.

This sort of functionality should be provide in Silverlight. If not, I'm afraid that MS has lost us (and perhaps others) as developers. Perhaps MS believes there's a security issue but clearly FLASH (Adobe) has addressed that in their implementation.

Please... Microsoft Silverlight staff. Please write the definitive answer about current status (which looks like a resounding "no") and what future (and near future at that) plans are in this regard.

And many thanks! m3taverse for your very very helpful reply

tom





Re: Silverlight (formerly WPF/E) Developer Issues how listen for and use scriptcommands in Silverlight

m3taverse

We're in exactly the same position Tom.

Supporting markers and ScriptCommands is the way to unlock all archived Windows Media materials instantly, of which we have a huge amount online. Without markers and scripts we cannot use Silverlight on top of our extensive Windows Media platform.

Now of course since we can reliably play Windows Media on a Mac now with Silverlight, this will give us for the first time ever a reliable cross platform way of reading the Position of the file that is being played. So for on demand scenarios, we can still implement our own functionality that works pretty much like Scripts and Markers.

As those of us who work in the streaming media business know, there is a lot of pressure from the market to "convert to Flash", so I have to make development choices soon. We either do the Flash conversion thing, or we go the Silverlight way. With Silverlight being new and presumably unknown by our customers for quite a while, without Script support available in SIlverlight, the better choice seems to be Flash.

What I *really* need is ScriptCommands in a live scenario, that would solve all our problems and instantly unlock our entire platform.

I cannot implement exact media syncing without ScriptCommands.

I hope someone is able to answer our questions :

Is it currently possible to receive Script Commands with Silverlight If not, are there any plans to implement it and is there an idea about when this will be

If it's implemented already, how do we use it





Re: Silverlight (formerly WPF/E) Developer Issues how listen for and use scriptcommands in Silverlight

tbink

m3taverse wrote:

Now of course since we can reliably play Windows Media on a Mac now with Silverlight, this will give us for the first time ever a reliable cross platform way of reading the Position of the file that is being played. So for on demand scenarios, we can still implement our own functionality that works pretty much like Scripts and Markers.

As those of us who work in the streaming media business know, there is a lot of pressure from the market to "convert to Flash", so I have to make development choices soon. We either do the Flash conversion thing, or we go the Silverlight way. With Silverlight being new and presumably unknown by our customers for quite a while, without Script support available in SIlverlight, the better choice seems to be Flash.

What I *really* need is ScriptCommands in a live scenario, that would solve all our problems and instantly unlock our entire platform.

I cannot implement exact media syncing without ScriptCommands.

I hope someone is able to answer our questions :

Is it currently possible to receive Script Commands with Silverlight If not, are there any plans to implement it and is there an idea about when this will be

If it's implemented already, how do we use it

Thanks again for this feedback m3taverse,

I couldn't agree more. What we like about MS WinMedia and Silverlight:

  1. We can get the server side functionality we need to edit metadata of existing files via Win Media Format (sdk - note- IWMHeaderInfo) (FLASH will also do this though)
  2. WinMedia Encoder will embed scriptcommands into the live encoding stream (FLASH will also do this though)
  3. Silverlight allows us to create and alter objects on the fly at runtime (FLASH does NOT allow that... everything is precompiled as far as I know)

The upshot is that we are seriously considering using FLASH for video/audio and Silverlight for page / element level effects. We very much like the XAML / Javascript model but we simply must have scriptcommands cross-platform or we will bite the bullet and go with FLASH

Like you we are making decisions now (please listen to this thread Microsoft) about whether to go with FLASH Anim/Video vs. MS Silverlight/Win Media . If we are to make timely and well-informed decisions about where we put our development resources we need feedback from the most authoritive sources at MS as soon as possible.

tom





Re: Silverlight (formerly WPF/E) Developer Issues how listen for and use scriptcommands in Silverlight

tbink

I'm going to add one more note which I hope MS Development staff will see and respond to.

I see only <object Position="00:00:00" .../> as the means to have any interaction with WinMedia playback ... as opposed to the rich complement of properties and methods available via WinMedia Player's object.

What I had hoped for with Silverlight WinMedia (MediaElement) is much of what I have (and use) via the WinMedia Player object. What I see listed is barely useful to us for interactive video/audio driven multimedia (which is our business).

In any response from MS Silverlight development staff would include a response to this issue I'd very much appreciate it

tom





Re: Silverlight (formerly WPF/E) Developer Issues how listen for and use scriptcommands in Silverlight

Ed Maia MSFT

Tom,

Silverlight will have support for both Windows Media Markers and ScriptCommands by our next public release. You will be able to list Markers and ScriptCommands in the file header, add/remove new markers to the MediaElement (without affecting the media file), and receive an event when one of them is reached. Please let me know if this doesn't satisfy your requirements.

Thanks a lot,
Ed Maia
Silverlight Program Manager