"Play is not allowed when there is no source set " , OnNavigateTo , OnNavigatingFrom

Aug 17, 2012 at 6:46 AM
Edited Aug 17, 2012 at 6:48 AM

Hi , I am building a windows phone 7 app with live streaming .When i launch my app i am able to stream the video , but when i go back ( Hitting the back button ) and then come to the application i am not able to play the stream. The player throws the following exception

"Play is not allowed when there is no source set"

   protected override void OnNavigatedFrom(System.Windows.Navigation.NavigationEventArgs e)
        {         
            ptvPlayer.Stop();
            base.OnNavigatedFrom(e);

        }
    protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {

         PlaylistItem item = new PlaylistItem();

        //Define the media source : The URL from where the content will be streamed

                item.MediaSource = new Uri("http://playready.directtaps.net/smoothstreaming/SSWSS720H264/SuperSpeedway_720.ism/Manifest");
                // Delivery method : Adaptive Streaming
                item.DeliveryMethod = Microsoft.SilverlightMediaFramework.Plugins.Primitives.DeliveryMethods.AdaptiveStreaming;

                Player.Playlist.Add(item);

                Player.Play();
            }

Where am i going wrong ?