mirror of
https://github.com/knah/VRCMelonAssistant.git
synced 2024-09-30 00:56:15 +13:00
Changed to better performant video looping code
This commit is contained in:
parent
711deb50a8
commit
73ecc0590c
3 changed files with 8 additions and 14 deletions
|
@ -127,7 +127,7 @@ namespace ModAssistant
|
||||||
if (!sendMessage || MainWindow.Instance.BackgroundVideo.Source?.AbsoluteUri != videoUri.AbsoluteUri)
|
if (!sendMessage || MainWindow.Instance.BackgroundVideo.Source?.AbsoluteUri != videoUri.AbsoluteUri)
|
||||||
{
|
{
|
||||||
MainWindow.Instance.BackgroundVideo.Stop();
|
MainWindow.Instance.BackgroundVideo.Stop();
|
||||||
MainWindow.Instance.BackgroundVideoSource.Source = videoUri;
|
MainWindow.Instance.BackgroundVideo.Source = videoUri;
|
||||||
}
|
}
|
||||||
MainWindow.Instance.BackgroundVideo.Play();
|
MainWindow.Instance.BackgroundVideo.Play();
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,19 +16,7 @@
|
||||||
<ImageBrush x:Name="BackgroundImage" Stretch="{DynamicResource BackgroundImageStretch}"/>
|
<ImageBrush x:Name="BackgroundImage" Stretch="{DynamicResource BackgroundImageStretch}"/>
|
||||||
</Rectangle.Fill>
|
</Rectangle.Fill>
|
||||||
</Rectangle>
|
</Rectangle>
|
||||||
<MediaElement Visibility="Hidden" LoadedBehavior="Manual" Name="BackgroundVideo">
|
<MediaElement Visibility="Hidden" LoadedBehavior="Manual" Name="BackgroundVideo" MediaEnded="BackgroundVideo_MediaEnded"/>
|
||||||
<MediaElement.Triggers>
|
|
||||||
<EventTrigger RoutedEvent="MediaElement.Loaded">
|
|
||||||
<EventTrigger.Actions>
|
|
||||||
<BeginStoryboard>
|
|
||||||
<Storyboard>
|
|
||||||
<MediaTimeline Name="BackgroundVideoSource" Storyboard.TargetName="BackgroundVideo" RepeatBehavior="Forever"/>
|
|
||||||
</Storyboard>
|
|
||||||
</BeginStoryboard>
|
|
||||||
</EventTrigger.Actions>
|
|
||||||
</EventTrigger>
|
|
||||||
</MediaElement.Triggers>
|
|
||||||
</MediaElement>
|
|
||||||
<Image x:Name="SideImage" UseLayoutRounding="True" SnapsToDevicePixels="True" HorizontalAlignment="Left" VerticalAlignment="{DynamicResource SideImageYPosition}" Width="{Binding RelativeSource={RelativeSource Self}, Path=Source.PixelWidth}" Height="{Binding RelativeSource={RelativeSource Self}, Path=Source.PixelHeight}" Stretch="Fill"/>
|
<Image x:Name="SideImage" UseLayoutRounding="True" SnapsToDevicePixels="True" HorizontalAlignment="Left" VerticalAlignment="{DynamicResource SideImageYPosition}" Width="{Binding RelativeSource={RelativeSource Self}, Path=Source.PixelWidth}" Height="{Binding RelativeSource={RelativeSource Self}, Path=Source.PixelHeight}" Stretch="Fill"/>
|
||||||
<Grid Margin="10">
|
<Grid Margin="10">
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
|
|
|
@ -303,5 +303,11 @@ namespace ModAssistant
|
||||||
Mods.Instance.RefreshColumns();
|
Mods.Instance.RefreshColumns();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void BackgroundVideo_MediaEnded(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
BackgroundVideo.Position = TimeSpan.Zero;
|
||||||
|
BackgroundVideo.Play();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue