在wpf中 mediaElement 怎么播放在线音频,求代码 谢谢
<Window x:Class="WpfApp.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="450" Width="800">
<Grid>
<MediaElement x:Name="mediaElement" LoadedBehavior="Manual" Loaded="MediaElement_Loaded" />
</Grid>
</Window>
using System;
using System.Windows;
namespace WpfApp
{
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
private void MediaElement_Loaded(object sender, RoutedEventArgs e)
{
mediaElement.Source = new Uri("http://audios.muzhiyun.cn/muzhicloud/9208750090/tts5/2023-08-02/ea791dc2-7e01-44e0-9f14-96bc49b7d240.mp3");
mediaElement.Play();
}
}
}
提示: System.NullReferenceException:“未将对象引用设置到对象的实例
不支持https!!!!汗
不支持https!!!!汗