mirror of
https://github.com/knah/VRCMelonAssistant.git
synced 2024-06-29 03:20:18 +12:00
Changed to better performant video looping code
This commit is contained in:
parent
711deb50a8
commit
73ecc0590c
|
@ -127,7 +127,7 @@ namespace ModAssistant
|
|||
if (!sendMessage || MainWindow.Instance.BackgroundVideo.Source?.AbsoluteUri != videoUri.AbsoluteUri)
|
||||
{
|
||||
MainWindow.Instance.BackgroundVideo.Stop();
|
||||
MainWindow.Instance.BackgroundVideoSource.Source = videoUri;
|
||||
MainWindow.Instance.BackgroundVideo.Source = videoUri;
|
||||
}
|
||||
MainWindow.Instance.BackgroundVideo.Play();
|
||||
}
|
||||
|
|
|
@ -16,19 +16,7 @@
|
|||
<ImageBrush x:Name="BackgroundImage" Stretch="{DynamicResource BackgroundImageStretch}"/>
|
||||
</Rectangle.Fill>
|
||||
</Rectangle>
|
||||
<MediaElement Visibility="Hidden" LoadedBehavior="Manual" Name="BackgroundVideo">
|
||||
<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>
|
||||
<MediaElement Visibility="Hidden" LoadedBehavior="Manual" Name="BackgroundVideo" MediaEnded="BackgroundVideo_MediaEnded"/>
|
||||
<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.RowDefinitions>
|
||||
|
|
|
@ -303,5 +303,11 @@ namespace ModAssistant
|
|||
Mods.Instance.RefreshColumns();
|
||||
}
|
||||
}
|
||||
|
||||
private void BackgroundVideo_MediaEnded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
BackgroundVideo.Position = TimeSpan.Zero;
|
||||
BackgroundVideo.Play();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue