C# Класс Chirp.Radio.Agent.AudioPlayer

Наследование: AudioPlayerAgent
Показать файл Открыть проект

Открытые методы

Метод Описание
AudioPlayer ( ) : System AudioPlayer instances can share the same process. Static fields can be used to share state between AudioPlayer instances or to communicate with the Audio Streaming agent.
SetCurrentTrack ( string artistName, string trackName, string album ) : void

Защищенные методы

Метод Описание
OnCancel ( ) : void

Called when the agent request is getting cancelled

Once the request is Cancelled, the agent gets 5 seconds to finish its work, by calling NotifyComplete()/Abort().

OnError ( BackgroundAudioPlayer player, AudioTrack track, Exception error, bool isFatal ) : void

this is no good! i think the json api stuff has to move in here so that it runs in the background. the front-end should be bound to the current track

Called whenever there is an error with playback, such as an AudioTrack not downloading correctly

This method is not guaranteed to be called in all cases. For example, if the background agent itself has an unhandled exception, it won't get called back to handle its own errors.

OnPlayStateChanged ( BackgroundAudioPlayer player, AudioTrack track, PlayState playState ) : void

Called when the playstate changes, except for the Error state (see OnError)

Play State changes cannot be cancelled. They are raised even if the application caused the state change itself, assuming the application has opted-in to the callback. Notable playstate events: (a) TrackEnded: invoked when the player has no current track. The agent can set the next track. (b) TrackReady: an audio track has been set and it is now ready for playack. Call NotifyComplete() only once, after the agent request has been completed, including async callbacks.

OnUserAction ( BackgroundAudioPlayer player, AudioTrack track, UserAction action, object param ) : void

Called when the user requests an action using application/system provided UI

User actions do not automatically make any changes in system state; the agent is responsible for carrying out the user actions if they are supported. Call NotifyComplete() only once, after the agent request has been completed, including async callbacks.

Приватные методы

Метод Описание
AudioPlayer_UnhandledException ( object sender, System.Windows.ApplicationUnhandledExceptionEventArgs e ) : void
GetNextTrack ( ) : AudioTrack

Implements the logic to get the next AudioTrack instance. In a playlist, the source can be from a file, a web request, etc.

The AudioTrack URI determines the source, which can be: (a) Isolated-storage file (Relative URI, represents path in the isolated storage) (b) HTTP URL (absolute URI) (c) MediaStreamSource (null)

GetPreviousTrack ( ) : AudioTrack

Implements the logic to get the previous AudioTrack instance.

The AudioTrack URI determines the source, which can be: (a) Isolated-storage file (Relative URI, represents path in the isolated storage) (b) HTTP URL (absolute URI) (c) MediaStreamSource (null)

Описание методов

AudioPlayer() публичный Метод

AudioPlayer instances can share the same process. Static fields can be used to share state between AudioPlayer instances or to communicate with the Audio Streaming agent.
public AudioPlayer ( ) : System
Результат System

OnCancel() защищенный Метод

Called when the agent request is getting cancelled
Once the request is Cancelled, the agent gets 5 seconds to finish its work, by calling NotifyComplete()/Abort().
protected OnCancel ( ) : void
Результат void

OnError() защищенный Метод

this is no good! i think the json api stuff has to move in here so that it runs in the background. the front-end should be bound to the current track Called whenever there is an error with playback, such as an AudioTrack not downloading correctly
This method is not guaranteed to be called in all cases. For example, if the background agent itself has an unhandled exception, it won't get called back to handle its own errors.
protected OnError ( BackgroundAudioPlayer player, AudioTrack track, Exception error, bool isFatal ) : void
player BackgroundAudioPlayer The BackgroundAudioPlayer
track AudioTrack The track that had the error
error System.Exception The error that occured
isFatal bool If true, playback cannot continue and playback of the track will stop
Результат void

OnPlayStateChanged() защищенный Метод

Called when the playstate changes, except for the Error state (see OnError)
Play State changes cannot be cancelled. They are raised even if the application caused the state change itself, assuming the application has opted-in to the callback. Notable playstate events: (a) TrackEnded: invoked when the player has no current track. The agent can set the next track. (b) TrackReady: an audio track has been set and it is now ready for playack. Call NotifyComplete() only once, after the agent request has been completed, including async callbacks.
protected OnPlayStateChanged ( BackgroundAudioPlayer player, AudioTrack track, PlayState playState ) : void
player BackgroundAudioPlayer The BackgroundAudioPlayer
track AudioTrack The track playing at the time the playstate changed
playState PlayState The new playstate of the player
Результат void

OnUserAction() защищенный Метод

Called when the user requests an action using application/system provided UI
User actions do not automatically make any changes in system state; the agent is responsible for carrying out the user actions if they are supported. Call NotifyComplete() only once, after the agent request has been completed, including async callbacks.
protected OnUserAction ( BackgroundAudioPlayer player, AudioTrack track, UserAction action, object param ) : void
player BackgroundAudioPlayer The BackgroundAudioPlayer
track AudioTrack The track playing at the time of the user action
action UserAction The action the user has requested
param object The data associated with the requested action. /// In the current version this parameter is only for use with the Seek action, /// to indicate the requested position of an audio track
Результат void

SetCurrentTrack() публичный Метод

public SetCurrentTrack ( string artistName, string trackName, string album ) : void
artistName string
trackName string
album string
Результат void