- sergey.sitnikov.nt
- Posts: 4
- Joined:
Controlling MediaElement from XAML with MediaTimeline
Hi guys,
I am unable to find the way to control MediaElement playback from XAML with the Storyboard and MediaTimeline as it is not yet implemented. Is there any workaround for it at the moment?
Cheers,
Sergey
I am unable to find the way to control MediaElement playback from XAML with the Storyboard and MediaTimeline as it is not yet implemented. Is there any workaround for it at the moment?
Cheers,
Sergey
-
sfernandez
Site Admin
- Posts: 2984
- Joined:
Re: Controlling MediaElement from XAML with MediaTimeline
Hi Sergey, we provide interactivity actions (PlayMediaAction, PauseMediaAction, RewindMediaAction and StopMediaAction) that can be executed with triggers, for example when a property changes or a storyboard completes.
Is that something you can use?
Is that something you can use?
- sergey.sitnikov.nt
- Posts: 4
- Joined:
Re: Controlling MediaElement from XAML with MediaTimeline
Yes, thank you Sergio! I have found those in the code:
Are there any plans to implement MediaTimeline in the future to keep it consistent with the WPF functionality?
Cheers,
Sergey
Code: Select all
<Grid
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
xmlns:ei="http://schemas.microsoft.com/expression/2010/interactions"
xmlns:noesis="clr-namespace:NoesisGUIExtensions;assembly=Noesis.GUI.Extensions">
<MediaElement Source="video.mp4" LoadedBehavior="Manual">
<i:Interaction.Triggers>
<i:EventTrigger EventName="MouseDown">
<noesis:PlayMediaAction />
</i:EventTrigger>
</i:Interaction.Triggers>
</MediaElement>
</Grid>
Cheers,
Sergey
- sergey.sitnikov.nt
- Posts: 4
- Joined:
Re: Controlling MediaElement from XAML with MediaTimeline
Hi Sergio,
I have tried to use those actions, however there are two issues related to it:
1) The latest publicly available Noesis.GUI.Extensions library (from NuGet) is 3.0.5 and it doesn't have those actions implemented. That makes Blend to trigger an error.
2) In UE4 when I use those actions to repeat the playback the video texture is not updated (staying black) but the sound is working correctly (repeating).
I have also tired a bit different approach with a custom MediaElement component and used Stop, SetPosition and Play on MediaEnded. Still the same issue with black texture.
Have you got any suggestions?
Cheers,
Sergey
P.S. I managed to work around that issue using Close() instead of Stop() before playing the file again. That actually destroyed and created a new instance of the MediaPlayer and fixed the problem. However, it would be great to know if there is a better approach to it and whether it is necessary to do something else to make those Actions work the same way (it wouldn't work out of the box for there is no Close action yet).
Sergey
I have tried to use those actions, however there are two issues related to it:
1) The latest publicly available Noesis.GUI.Extensions library (from NuGet) is 3.0.5 and it doesn't have those actions implemented. That makes Blend to trigger an error.
2) In UE4 when I use those actions to repeat the playback the video texture is not updated (staying black) but the sound is working correctly (repeating).
Code: Select all
<i:EventTrigger EventName="MediaEnded">
<noesis:StopMediaAction/>
<noesis:RewindMediaAction/>
<noesis:PlayMediaAction/>
</i:EventTrigger>
Have you got any suggestions?
Cheers,
Sergey
P.S. I managed to work around that issue using Close() instead of Stop() before playing the file again. That actually destroyed and created a new instance of the MediaPlayer and fixed the problem. However, it would be great to know if there is a better approach to it and whether it is necessary to do something else to make those Actions work the same way (it wouldn't work out of the box for there is no Close action yet).
Sergey
-
sfernandez
Site Admin
- Posts: 2984
- Joined:
Re: Controlling MediaElement from XAML with MediaTimeline
I updated the Noesis.GUI.Extensions nuget package and now it includes those media actions to be used in Blend.
Regarding the loop issue, I created ticket #2019 because we should fix that. In the meantime, as you found, you can workaround it by closing the media element and starting it again.
Regarding the loop issue, I created ticket #2019 because we should fix that. In the meantime, as you found, you can workaround it by closing the media element and starting it again.
Who is online
Users browsing this forum: Google [Bot], Semrush [Bot] and 78 guests