locked
Media element not playing audio in windows store app

    Question

  • I want to play mp3 audio in my app but nothing is happening my code is this

    <Page
        x:Class="SunnahForKids.MainPage"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:local="using:SunnahForKids"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        mc:Ignorable="d">
    
        <Grid Background="Black">
    
            <StackPanel Width="900" Height="700" HorizontalAlignment="Center">
                <MediaElement HorizontalAlignment="Left" Name="a" AutoPlay="False" Source="azan.mp3" Height="100" Margin="451,299,0,0" VerticalAlignment="Top" Width="100" Volume="100"/>
    
                <Button Content="Button" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="0,0,676,0" Height="189" Click="Button_Click"/>
            </StackPanel>
        </Grid>
    </Page>


    .cs

    private void Button_Click(object sender, RoutedEventArgs e)
            {
                a.Play();
    
            }



    and I am struggling with it for 2 days need help .

    I update my display driver but it is up to date.Display driver in Intel R(Q35) express chipset family ( Microsoft Corporation WDDM-1.0)

    please get me out of here..


    Saturday, March 22, 2014 9:22 AM

All replies

  • 1) is the mp3 file playable in other players, such as Windows Media Player? 2) is the file located in the same folder as the project?

    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Sunday, March 23, 2014 12:42 PM
    Moderator