Why Background Audio Isn’t Working?

Thursday, December 27, 2012

Using HTML 5 we can play audio very easily in your Windows Store app, all you need to do is setting an audio element specify the object properties and that’s it. var audioElement= document.createElement('audio'); audioElement.setAttribute("id", "audtag"); audioElement.setAttribute("controls", "true"); audioElement.setAttribute("src", fileToPlay); audioElement.setAttribute("autoplay", "true"); audioElement.load(); What if you want to keep playing this audio even if the user has switch to another application? In order to to that you’ll need to use “Background Audio” ability. First you need to declare the “Background Tasks” in your app package manifest file. Then you need to add the “msAudioCategory” attribute to the audio element: audtag.setAttribute("msAudioCategory", "BackgroundCapableMedia"); Now if you...

Windows.BackgroundTasks contract or is not installed

Friday, November 30, 2012

Yesterday I did some work on BackgroundTasks (CS) for customer application, while building the structure I faced an unfamiliar error and application crash when the Task was triggered. I’ve look into Windows Event Log and fond a error related to my application: Activation of app fcf446e9-4a89-4d56-b3ae-def1bab41ac2_d824bndbbbqn4!App failed with error: This app does not support the contract specified or is not installed. See the Microsoft-Windows-TWinUI/Operational log for additional information. So where can you find the “Microsoft-Windows-TWinUI/Operational“ log? Expend “Application and Services Logs” folder, Microsoft –> Windows –> Apps...

BackgroundExecutionManager.RequestAccessAsync() Element not found.

Working on Background Task for Windows Store app I faced a annoying issue, while calling: await BackgroundExecutionManager.RequestAccessAsync(); I’ve received the following error: The problem was I put BreakPoint before the line, once I’ve removed the breakpoint below that line everything works just fine. I don’t know why this is happening but this is how I “Solved” the problem. Enjoy