c# - Use the MediaElement cause the error "The background audio resources are no longer available." -


in app, have use audioplaybackagent (apa) , mediaelement. used apa play songs , , when need play video, use mediaelement

when navigate page use mediaelement, stop backgroundaudioplayer:

backgroundaudioplayer.instance.pause(); 

when navigate page need play music, call apa start again, return exception "the background audio resources no longer available." :(

protected override void onnavigatedto(navigationeventargs e)     {                     base.onnavigatedto(e);          try         {             if (backgroundaudioplayer.instance.playerstate != playstate.playing)                 backgroundaudioplayer.instance.play();                         }         catch         {              backgroundaudioplayer.instance.play();         }     } 

i can use mediaplayerlauncher , solution has many disvantage (only fullscreen, lack of custom control ...). there way make media element work along audioplaybackagent, or other way playing video ???

this occurs because data lost when navigating between pages. can try saving data isolatedstorage. can find more information in question: save values between page navigation in windows phone


Comments

Popular posts from this blog

php - Submit Form Data without Reloading page -

linux - Rails running on virtual machine in Windows -

php - $params->set Array between square bracket -