TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Dilip Apte
NA
8
24.3k
Playing MP3 / wav file in WPF
Jul 12 2010 1:34 AM
Hi,
I am trying to play a local MP3 / wav file in WPF form but unable to here sound. System is not giving any error but sound cannot be heard. I am able to play file form windows media player outside the application.
Here is the xaml code
<
MediaElement
Canvas.Left
="441"
Canvas.Top
="395"
Height
="18"
Name
="mysound"
Width
="24"
MediaOpened
="mysound_MediaOpened"
Volume
="1"
LoadedBehavior
="Manual" />
and cs code:
private
void
button1_Click(
object
sender,
RoutedEventArgs
e)
{
mysound.Source =
new
Uri
(
"/sounds/jungle_drum.wav"
,
UriKind
.Relative);
mysound.Play();
}
I tried both UriKind.Relative and Absolute but it didn't work. Sounds folder is in the root of project folder.
Can anyone help me debugging?
Regards.
Dilip
Reply
Answers (
6
)
Load Images dynamically in Listbox through Data Binding using ObservableCollection data object
WPF windowformhosts transparency issue