Skip to content

Internal Mailbag: Media restarts after tree changes in ancestor hierarchy

June 26, 2007

Internal mail thread that I thought might be useful, please read bottom-up:

From: MS Employee
Worked perfectly. Thanks!

From: Helpful MS Employee
This behavior is not a problem, it is intentional because media needs deterministic finalization and the only way to achieve this in WPF is to used OnLoad() since WPF doesn’t support IDisposable correctly.

To work around this, please see the LoadedBehavior and UnloadedBehavior properties on MediaElement. You probably want both to be “Manual” and then to use either the Player controls (Play, Pause, Stop, Close) on the MediaElement or you can use Animation (no deterministic close with animations though).

From: MS Employee
Subject: media automatically restarting?

I’m trying to take a playing video and change where it is currently rendering. I’m noticing a problem that the video restarts when I make certain changes to its parent hierarchy. For example, if I place it in a container that is Visibility.Collapsed. Is there any way to have a video that is not currently visible continue to play?

Note: I’ll follow up on the comment about "since WPF doesn’t support IDisposable correctly"….don’t know what this helpful guy means…

From → WPF

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: