R
R
Re_translator2019-11-10 19:14:07
WPF
Re_translator, 2019-11-10 19:14:07

Why doesn't sound play through MediaPlayer?

WPF project. I use MediaPlayer to play music, and I uploaded the .mp3 file to the resources. If I specify the full path of the file, for example

gamePlayer.Open(new Uri("D:/C#/Resources/callme.mp3", UriKind.Absolute));

there is sound and everything is fine. If I do not specify the full path, then there are no sounds.
gamePlayer.Open(new Uri(AppDomain.CurrentDomain.BaseDirectory + "/Resources/90sFlavCallMe.wav", UriKind.Absolute));

On the Windows mixer, you can see that there should be some sounds in the application, but nothing is played.
And now I don't know what to do. Is it possible to get by with built-in tools here?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
MacAntony, 2019-11-10
@Re_translator

Are you sure you're pointing the right way? Try without the leading slash: "/Resources/90sFlavCallMe.wav".

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question