WPF 两个mediaElement1同时播放的时候就报错
private void Window_Loaded(object sender, RoutedEventArgs e)
{
mediaElement1.Source = new Uri(@"C:\Users\JACK\Desktop\新建文件夹 (2)\da1.avi");
mediaElement2.Source = new Uri(@"C:\Users\JACK\Desktop\新建文件夹 (2)\da1.avi");
mediaElement1.Play();
mediaElement2.Play();
}
<Window x:Class="WpfApplication5.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="768" Width="1792" WindowStyle="None" ResizeMode="NoResize" Loaded="Window_Loaded">
<Grid>
<MediaElement Height="418" HorizontalAlignment="Left" Margin="214,299,0,0" Name="mediaElement1" VerticalAlignment="Top" Width="706" LoadedBehavior="Manual" />
<MediaElement Height="418" HorizontalAlignment="Left" Margin="934,299,0,0" Name="mediaElement2" VerticalAlignment="Top" Width="706" LoadedBehavior="Manual" />
</Grid>
</Window>
这段代码编译的时候会报两种错,似乎没有啥规律
如果开始播放一个,再播放一个就没事
补充:.NET技术 , C#