Note that there are some explanatory texts on larger screens.

plurals
  1. POcontinue playing music when app closes
    primarykey
    data
    text
    <p>I am developing an app in wp7 and in some part.</p> <p>I start a mediaelement to play my music file from isolated storage, with available functions(play, pause, next, previous, seek) and all goes perfect!</p> <p>Now i want to make the app continue playing on user-exit or page-unload or something like that when mediaelement already playing!</p> <p>Notice in the abobe try the</p> <pre> list.playlist: is a list with audiotracks num_input: is the number of music file in list that will play, (get: from mediaelement) time_input: is the timespan from mediaelement before stop, (set: backgroundaudioplayer to start) play: is boolean variable, true if mediaelement plays Stop(): is function that stops mediaelement from playing </pre> <p>Thats i am trying is:</p> <pre><code>private void PhoneApplicationPage_Unloaded(object sender, RoutedEventArgs e) { if (play == true) { TimeSpan time_input = med.Position; Stop(); BackgroundAudioPlayer.Instance.Close(); BackgroundAudioPlayer.Instance.Track = list.playlist[num_input]; BackgroundAudioPlayer.Instance.Position = time_input; if (PlayState.Playing == BackgroundAudioPlayer.Instance.PlayerState) { BackgroundAudioPlayer.Instance.Pause(); } else { BackgroundAudioPlayer.Instance.Play(); } } } void Instance_PlayStateChanged(object sender, EventArgs e) { switch (BackgroundAudioPlayer.Instance.PlayerState) { case PlayState.Playing: break; case PlayState.Paused: case PlayState.Stopped: break; } } </code></pre> <p>The problem is that when the app page-unload (not on user exit, the first problem) the backgroundaudioplayer gets the name and the EnabledControls and all staff but it isn't playing even I press the play button(so buttons not working, second problem)!</p> <p>Also i want to control the list of my app beside that player(previous, next, play, pause) even the app is closed!</p> <p>All the songs are located in isolated and i have the song-name and file-name in database. The audio track looks like:</p> <pre><code>AudioTrack audiotrack1 = new AudioTrack(new Uri(emp.EmployeeFile + ".mp3", UriKind.Relative), emp.EmployeeName, null, null, null, null, EnabledPlayerControls.All); </code></pre> <p>Thanks!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload