IT tutorials
 
Technology
 

Windows Phone 8 : Audio Streaming Agents (part 1)

3/1/2014 8:09:32 PM
- Free product key for windows 10
- Free Product Key for Microsoft office 365
- Malwarebytes Premium 3.7.1 Serial Keys (LifeTime) 2019

Audio streaming agents allow you to customize how audio files are downloaded and decoded by your app, and they enable you to support live streaming scenarios not natively supported by the phone.

An audio streaming agent can be created in the same manner as an audio player agent, by using the “Windows Phone Audio Streaming Agent” Visual Studio project template .

The Visual Studio project template produces a class that derives from AudioStreamingAgent. The agent must then be registered with your main project’s WMAppManifest.xml file, which is done automatically when linking to an Audio Streaming Agent project. The XML definition can be seen alongside the AudioPlayerAgent, as shown:

<Tasks>
  <DefaultTask  Name="_default" NavigationPage="MainPage.xaml"/>
    <ExtendedTask Name="BackgroundTask">
        <BackgroundServiceAgent Specifier="AudioPlayerAgent"
            Name="<Unique name within the app>"
            Source="<Assembly>"
            Type="<Namespace.Class>" />
        <BackgroundServiceAgent Specifier="AudioStreamingAgent"
            Name="<Unique name within the app>"
            Source="<Assembly>"
            Type="<Namespace.Class>" />
    </ExtendedTask>
</Tasks>

Registering a custom AudioStreamingAgent does not disable the built-in streaming and decoding of the phone. The OS determines whether to use the built-in audio streaming, or your custom AudioStreamingAgent, based on the AudioTrack’s Source property, each time a new AudioTrack is played. To have your custom AudioStreamingAgent called for a particular track, assign the Source property of the AudioTrack to null, as shown in the following excerpt:

new AudioTrack(null, /* Uri is null so that it is sent
                      * to the AudioStreamingAgent
                      * called AssemblyAudioStreamingAgent. */
                      "Assembly Track!",
                      "Acquired using AudioStreamingAgent",
                      "Unleashed",
                      null,
                      "AudioFiles/Audio04.mp3", // Tag parameter.
                      EnabledPlayerControls.All),

If the Uri is not null, the OS performs all streaming and decoding. By using this technique, you can use a combination of both the inbuilt streaming and decoding for some tracks, and custom streaming and decoding for others.

The AudioTrack class contains a Tag property, which can be used to pass information to an AudioStreamingAgent. Notice from the previous excerpt that this property is set to the relative path of an audio file resource. You see, in the next section, how this value is used to resolve an audio file resource from the current assembly.

AudioStreamingAgent contains a virtual method named OnBeginStreaming, which is overridden to handle streaming and decoding of an audio track. The method has two parameters: the AudioTrack and an AudioStreamer. The AudioStreamer allows you to attach your own MediaStreamSource. MediaStreamSource provides you with direct access to APIs for manipulating encoded elementary audio and video streams. It enables you to implement your own mechanism for processing the contents of a media file, enabling support beyond the native built-in media formats.

Although this section does not cover MediaStreamSource in detail, it does, however, look at applying a specialized MediaStreamSource from the ManagedMediaHelpers project to enable the playback of audio files that are located in an app’s assembly, something that is not supported by the phone’s built-in streaming and decoding system.

 
Others
 
- Windows Phone 8 : AudioPlayerAgent Sample (part 4) - Controlling Background Audio from Your Foreground App - Monitoring Playback Progress
- Windows Phone 8 : AudioPlayerAgent Sample (part 3) - Controlling Background Audio from Your Foreground App - MainPageViewModel
- Windows Phone 8 : AudioPlayerAgent Sample (part 2) - AudioPlayerAgent Virtual Methods
- Windows Phone 8 : AudioPlayerAgent Sample (part 1)
- Windows Phone 8 : Coordinating Background Audio Playback (part 2) - Representing Audio Files with the AudioTrack Class, Creating a Custom Audio Player Agent
- Windows Phone 8 : Coordinating Background Audio Playback (part 1) - Background Audio Player
- Microsoft Exchange Server 2013 : Site mailboxes (part 3) - The life cycle of site mailboxes, Site mailbox provisioning policy
- Microsoft Exchange Server 2013 : Site mailboxes (part 2) - How site mailboxes work - Synchronization between Exchange and SharePoint
- Microsoft Exchange Server 2013 : Site mailboxes (part 1) - How site mailboxes work
- Microsoft Exchange Server 2013 : Migration to modern public folders
 
 
Top 10
 
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 2) - Wireframes,Legends
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 1) - Swimlanes
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Formatting and sizing lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Adding shapes to lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Sizing containers
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 3) - The Other Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 2) - The Data Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 1) - The Format Properties of a Control
- Microsoft Access 2010 : Form Properties and Why Should You Use Them - Working with the Properties Window
- Microsoft Visio 2013 : Using the Organization Chart Wizard with new data
Technology FAQ
- Is possible to just to use a wireless router to extend wireless access to wireless access points?
- Ruby - Insert Struct to MySql
- how to find my Symantec pcAnywhere serial number
- About direct X / Open GL issue
- How to determine eclipse version?
- What SAN cert Exchange 2010 for UM, OA?
- How do I populate a SQL Express table from Excel file?
- code for express check out with Paypal.
- Problem with Templated User Control
- ShellExecute SW_HIDE
programming4us programming4us