UWP Bug with AppWindows and MediaTransportation Controls

50 Views Asked by At

posibly related to ContentDialog on correct UWP AppWindow

I have an app, user can record his video on camera, i have two Windows a Core Window and AppWindow, the app is UWP, WinUI 2.8

So when app starts i create my two windows, then i create my custom MediaCapture service, then i display control with record button like that:

<controls:SwitchPresenter Value="{x:Bind IsComplete, Converter={StaticResource BoolToString}, Mode=OneWay}" >
    <controls:Case Value="False">
        <StackPanel Spacing="24" Margin="0 12">
            <Grid BorderBrush="{x:Bind IsRecording, Converter={StaticResource BoolToRecordingConverter}, Mode=OneWay}" 
                  BorderThickness="{x:Bind IsRecordingStarted, Converter={StaticResource BoolToThikness}, Mode=OneWay}">
                <c:CameraPreviewControl Countdown="{x:Bind Countdown, Mode=OneWay}" Time="{x:Bind RecordingTime, Mode=OneWay}" IsRecording="{x:Bind IsRecording, Mode=OneWay}"/>
            </Grid>
            <StackPanel Orientation="Horizontal">
                <!-- STATE COMMANDS -->
            </StackPanel>
        </StackPanel>
    </controls:Case>
    <controls:Case Value="True">
        <StackPanel Spacing="24" Margin="0 12">
            <MediaPlayerElement Source="{x:Bind VideoFile, Mode=OneWay, Converter={StaticResource StorageFileToMediaSource}}" Width="746" Height="560" Stretch="UniformToFill" FlowDirection="RightToLeft" 
                           Style="{StaticResource MYMediaPlayerElementStyle}">
                <MediaPlayerElement.TransportControls >
                    <!-- THATS THE PROBLEM IS -->
                    <MediaTransportControls Style="{StaticResource MYMediaTransportControlsStyle}">
                    <!-- XamlRoot="{x:Bind GetXamlRoot}" -->
                                            IsFastForwardButtonVisible="False"
                                            IsFastRewindButtonVisible="False"
                                            IsNextTrackButtonVisible="False"
                                            IsPreviousTrackButtonVisible="False"
                                            IsRepeatButtonVisible="True"
                                            IsRepeatEnabled="True"
                                            IsStopButtonVisible="False"
                                            IsPlaybackRateButtonVisible="False" 
                                            IsFullWindowEnabled="False" 
                                            IsFullWindowButtonVisible="False" 
                                            IsZoomButtonVisible="False" 
                                            IsPlaybackRateEnabled="False"
                                            IsCompact="True" 
                                            />
                </MediaPlayerElement.TransportControls>
            </MediaPlayerElement>
            <StackPanel Orientation="Horizontal" Visibility="{x:Bind IsFinished, Converter={StaticResource BoolToNegatedVisibility}, Mode=OneWay}">
                <!-- STATE COMMANDS  (OK CANCEL BUTTONS)-->
            </StackPanel>
        </StackPanel>
    </controls:Case>
</controls:SwitchPresenter>

So as soon as set AreTransportControlsEnabled on MediaPlayerElement and the widget is in AppWindow instance i get win32 unhandled exception

I tryd to drill XamlRoot in there without succes, if widget is in Core Window everthyng works as expected...

I suspect that this might be relaed to Dialogs, for case when it wants to open full screen dialog don't have correct XamlRoot set but it took me two days to get to the bottom of the error lol... But then on the next step on the same page i open modal with video that has exectly same StorageFile and a MediaPlayer element and it's still works as expected... so... no clue what can be sourec of that...

If anyone know how to potentialy fix i would be super gratefull

exception is: code 3221225477 (0xc0000005) 'Access violation'.

Update

Seems issue coming from me commenting out some unnecessary controls in control template

reproducible git https://github.com/antokhio/AppWindowMediaPlayerCrashTester

0

There are 0 best solutions below