C
C#7mo ago
CaptnCario

Play a Sound file as a URL Link in WPF

c#
private void soundButton_Click(object sender, RoutedEventArgs e)
{
MediaPlayer playSound = new MediaPlayer();
playSound.Open(new Uri("https://www.pokewiki.de/images/5/53/Ruf_393.mp3"));
playSound.Play();
}
c#
private void soundButton_Click(object sender, RoutedEventArgs e)
{
MediaPlayer playSound = new MediaPlayer();
playSound.Open(new Uri("https://www.pokewiki.de/images/5/53/Ruf_393.mp3"));
playSound.Play();
}
Does anybody have an Idea, why it isnt working, it always says its null
3 Replies
canton7
canton77mo ago
"it always says it is null" -- what two things do "it" refer to there?
The Fog from Human Resources
Make sure Mediaplayer is even suited for links cause it might be for local files only
jcotton42
jcotton426mo ago
@CaptnCario first, switch to a local file. It’s honestly rude to “hotlink” media like this, so download the audio file and add it to your project. Or at least download it on first app start and store it somewhere.
Want results from more Discord servers?
Add your server