I have a MediaElement to play an audio by streaming it through the server.
XAML:
<MediaElement
x:Name="questionMedia"
Grid.Row="0"
Margin="20,5,0,10"
Width="300"
Height="55"
HorizontalAlignment="Left"
AreTransportControlsEnabled="True"
AutoPlay="False"
Visibility="Visible">
<MediaElement.TransportControls>
<MediaTransportControls IsCompact="True" IsFullWindowButtonVisible="False"/>
</MediaElement.TransportControls>
</MediaElement>
Code:
string audioURL = "https://ujian.study.id/uploads/questions/audio/553.mp3";
questionMedia.Source = new Uri(audioURL);
I'm having a problem where the app keeps exiting and the error message below appears:

If I don't set the width and height of the mediaelement, then the error doesn't occur, but the audio won't play because I set AutoPlay = false.
How to handle it?