NovCTP - MediaPlayerSample

Hi,

Anyone have a sample on how to draw video in NovCTP.
I have the following at the momment but fails to play video just audio.

MediaPlayer player;

public Window1(){

InitializeComponent();
player =
newMediaPlayer();
MediaTimeline t =newMediaTimeline();
t.Source =
newUri(@"Japan.wmv");
MediaClock c = t.CreateClock();
player.Clock = c;
}

protectedoverridevoid OnRender(DrawingContext drawingContext){

drawingContext.DrawVideo(player,newRect(RenderSize));
base.OnRender(drawingContext);
}

kind regards,

[1675 byte] By [Andy_Webber] at [2007-12-26]
# 1
Are you trying to do something fancy with multiple renderings or just want to get video to play? The MediaElement handles rendering more directly than overriding OnRender. In Nov CTP there is a new per-frame notification you could use to trigger a refresh and use something like a DrawingVisual or one of the others. You really want to get away from immediate mode rendering with WPF. As much as possible set up the elements you want rendered and let the system do it. Even for fancy synchronized rendering the new notification allows you to alter the drawing on a per-frame basis without resorting to imediate mode drawing.
MichaelLatta at 2007-9-4 > top of Msdn Tech,Visual Studio Orcas,Windows Presentation Foundation (WPF)...
# 2
Thanks for the advice. The domain is rather more complicated but your advice is noted; I will start to move that way. The real problem for me i think was the change in the mechanics of the media element. i used to be able to stream from a custom httplistener to the DrawingContext, now media player or element does not play the stream however WMP does [tears!] :D
Andy_Webber at 2007-9-4 > top of Msdn Tech,Visual Studio Orcas,Windows Presentation Foundation (WPF)...
# 3
The reason nothing is being drawing is likely because Window has a default style with some child drawing a white background over the whole Window. You can use DrawVideo into a DrawingVisual, or create a customized control/UIElement and override its OnRender method with the one you have above.

As for streaming from an http URL, it is expected to work. If not, it is likely not related to the code sample you have above.

EdMaia at 2007-9-4 > top of Msdn Tech,Visual Studio Orcas,Windows Presentation Foundation (WPF)...
# 4
Hmm, im doing on override OnRender here but i guess i can try again.

as for the streaming it probably me but
<MediaElement Source="C:\Inetpub\wwwroot\ImagineBlogger\2.asf"/> Works
<MediaElement Source="http://awebbermedia/imagineblogger/2.asf"/> Doesnt

Andy_Webber at 2007-9-4 > top of Msdn Tech,Visual Studio Orcas,Windows Presentation Foundation (WPF)...
# 5
The streaming case is a bug with the November CTP, and should be fixed in subsequent releases.
EdMaia at 2007-9-4 > top of Msdn Tech,Visual Studio Orcas,Windows Presentation Foundation (WPF)...
# 6

Thank the lord!, i thought i was insane.

my boss wont fire me now, thanks

Andy_Webber at 2007-9-4 > top of Msdn Tech,Visual Studio Orcas,Windows Presentation Foundation (WPF)...
# 7

Andy_Webber_ wrote:
Hmm, im doing on override OnRender here but i guess i can try again.

as for the streaming it probably me but
<MediaElement Source="C:\Inetpub\wwwroot\ImagineBlogger\2.asf"/> Works
<MediaElement Source="http://awebbermedia/imagineblogger/2.asf"/> Doesnt

Has anyone figured this out, I cannot get it work either. Thanks, Dvl

Dvlnblk at 2007-9-4 > top of Msdn Tech,Visual Studio Orcas,Windows Presentation Foundation (WPF)...

Visual Studio Orcas

Site Classified