Click here to Skip to main content
15,885,998 members
Articles / Mobile Apps

Resume the User’s Music after MediaPlay

Rate me:
Please Sign up or sign in to vote.
4.96/5 (16 votes)
8 Nov 2010Ms-PL6 min read 47.9K   882   14  
How to Resume the User's music after we played a video or audio from our Silverlight/XNA WP7 Application.
<phone:PhoneApplicationPage 
    x:Class="ResumeMusicPlayTest.SSMediaElementPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:ssme="clr-namespace:Microsoft.Web.Media.SmoothStreaming;assembly=Microsoft.Web.Media.SmoothStreaming"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="Portrait" Orientation="Portrait"
    mc:Ignorable="d" d:DesignHeight="768" d:DesignWidth="480"
    shell:SystemTray.IsVisible="True">

    <!--LayoutRoot is the root grid where all page content is placed-->
    <Grid x:Name="LayoutRoot" Background="Transparent">
        <ssme:SmoothStreamingMediaElement x:Name="ssMediaElement" 
                      Margin="0,0,0,0" 
                      HorizontalAlignment="Stretch"
                      AutoPlay="True"
                      Stretch="Uniform" 
                      Volume="50" 
                      ManipulationStarted="ssMediaElement_ManipulationStarted"
                      MediaEnded="ssMediaElement_MediaEnded"
                      CurrentStateChanged="ssMediaElement_CurrentStateChanged"                   
                      ManifestReady ="ssMediaElement_ManifestReady"
                      MediaFailed ="ssMediaElement_MediaFailed"
                      MediaOpened ="ssMediaElement_MediaOpened"
                      BufferingProgressChanged ="ssMediaElement_BufferingProgressChanged"
                      DownloadProgressChanged ="ssMediaElement_DownloadProgressChanged"
                      DownloadTrackChanged ="ssMediaElement_DownloadTrackChanged"
                      LiveEventCompleted ="ssMediaElement_LiveEventCompleted"

                      PlaybackTrackChanged ="ssMediaElement_PlaybackTrackChanged"
                      SmoothStreamingErrorOccurred ="ssMediaElement_SmoothStreamingErrorOccurred"
                      LogReady ="ssMediaElement_LogReady"
                                          />
    </Grid>
 
    <!--Sample code showing usage of ApplicationBar-->
    <!--<phone:PhoneApplicationPage.ApplicationBar>
        <shell:ApplicationBar IsVisible="True" IsMenuEnabled="True">
            <shell:ApplicationBarIconButton IconUri="/Images/appbar_button1.png" Text="Button 1"/>
            <shell:ApplicationBarIconButton IconUri="/Images/appbar_button2.png" Text="Button 2"/>
            <shell:ApplicationBar.MenuItems>
                <shell:ApplicationBarMenuItem Text="MenuItem 1"/>
                <shell:ApplicationBarMenuItem Text="MenuItem 2"/>
            </shell:ApplicationBar.MenuItems>
        </shell:ApplicationBar>
    </phone:PhoneApplicationPage.ApplicationBar>-->

</phone:PhoneApplicationPage>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Microsoft Public License (Ms-PL)


Written By
Software Developer
Hungary Hungary
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions