Hi, this is driving me pretty crazy. I'm trying to get a WMV file to autoreverse after it's done playing, but it doesn't work. I've tried setting Storyboard autoreverse to true, but this throws an error saying that
"Clocks with CanSlip cannot have parents or ancestors with AutoReverse, AccelerationRatio, or DecelerationRatio."
Is this because I'm not using animation but a video? How can I achieve the same thing? The video I've got is working, both play and pause and resume. But after it's finished it just stops.
I've got three storyboards all together, one which is the video itself. And two where there's an animation which fades out a white rectangle just as the video plays and pauses.
The code looks like this:
public partial class Window1
{
public Storyboard RectangleFadeA;
public Storyboard RectangleFadeBackA;
public Storyboard VideoA;
bool isPlaying;
bool isPaused;
public Window1()
{
this.InitializeComponent();
// Insert code required on object creation below this point.
RectangleFadeA = (Storyboard)TryFindResource("RectangleFadeA");
RectangleFadeBackA = (Storyboard)TryFindResource("RectangleFadeBackA");
VideoA = (Storyboard)TryFindResource("GTTV_promo_wmv");
isPlaying = false;
isPaused = false;
}
private void rectangle_MouseDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
if (!isPlaying)
{
if (!isPaused)
{
if (RectangleFadeA != null)
RectangleFadeA.Begin(this, true);
if (VideoA != null)
VideoA.Begin(this, true);
isPlaying = true;
return;
}
if (isPaused)
{
if (RectangleFadeA != null)
RectangleFadeA.Begin(this, true);
if (VideoA != null)
VideoA.Resume(this);
isPaused = false;
isPlaying = true;
return;
}
}
if (isPlaying)
{
if (RectangleFadeBackA != null)
RectangleFadeBackA.Begin(this, true);
VideoA.Pause(this);
isPlaying = false;
isPaused = true;
return;
}
}
}