Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unsupported APIs for AudioPlayerAgent

I'd like to use various APIs that are listed on this "Unsupported APIs for Background Agents" page, from within my AudioPlayerAgent. That page specifically mentions ScheduledTaskAgents:

There is a set of APIs that cannot be used in code executed by a Scheduled Task. This includes code contained in classes that implement ScheduledTaskAgent as code in any libraries that are called from a ScheduledTaskAgent. Some of these APIs are detected by the development tools and will raise an error at run or compile time. Other APIs are restricted by the Windows Phone Marketplace application submission process.

Does this mean that AudioPlayerAgents can use the APIs listed on that page? Both inherit Microsoft.Phone.BackgroundAgent, but only one is explicitly mentioned on that page and I'm not sure if an AudioPlayerAgent is considered to be a Scheduled Task. Can anyone confirm one way or the other?

like image 236
keyboardP Avatar asked Nov 13 '22 10:11

keyboardP


1 Answers

I think that for the "Unsupported APIs from Background Agents" applies to Background Audio too, with the obvious exception of BackgroundAudioPlayer. I backed this up by trying to add one of the unsupported APIs to the agent and running the SDK's Marketplace Test Kit against my test project (I tried Microsoft.Devices.VibrateController).

This caused the expected failure:

Result Details

[ERROR] : Unsupported API cannot be used by a background agent. Assembly AudioPlaybackAgent1.dll was trying to use Microsoft.Devices.VibrateController::get_Default.

[ERROR] : Unsupported API cannot be used by a background agent. Assembly AudioPlaybackAgent1.dll was trying to use Microsoft.Devices.VibrateController::Start.

[ERROR] : Unsupported API cannot be used by a background agent. Assembly AudioPlaybackAgent1.dll was trying to use Microsoft.Devices.VibrateController.

I would advise you check your APIs in against this tool and see what result you get.

These API restrictions make sense to me as you can think of the AudioPlayerAgent as a scheduled agent that runs only when there is user input (e.g. user presses play, pause, skip) or when a relevant audio event happens (e.g. track ends, new track is ready, playback starts). Similar CPU usage, run time and memory constraints exist on background audio agents as they do on scheduled agents.

like image 110
Paul Annetts Avatar answered Dec 20 '22 19:12

Paul Annetts