C# Class Youbora.Analytics.Player.YouboraAvPlayer

The Youbora player plugin is a piece of software that is integrated within the customer player and it's the responsible of listening and reporting to Youbora Analytics all the different player states in the current video session. By taking all the data from inside the player, Youbora Analytics is capable to measure the best quality of video experience from its source, the end user, and analyze the whole route from where the video is being delivered until the end user's player, passing through all the different path nodes from the network.
Inheritance: INotifyPropertyChanged
显示文件 Open project: NicePeopleAtWork/NicePlayers

Public Methods

Method Description
Buffer ( double time, double duration, string code ) : void

Detects when the end user is experiencing buffering issues.

Close ( ) : void

Reset all playback parameters

Data ( string system, string pluginVersion = DefaultPluginVersion ) : void

Init Youbora Data.

Data ( string system, string pluginVersion, string user, bool live ) : void

Init Youbora Data.

Error ( string errorCode ) : void

Reports a player error.

GetData ( string system, string pluginVersion = DefaultPluginVersion ) : Data
Init ( string userId ) : void

Initialize the playback and the plugin

Join ( string time, string code ) : void

Determines the elapsed amount of time since the end user clicks/touches the player's play button until the media starts to be played.

Pause ( ) : void

Informs when the user has paused the playback.

Ping ( string pingTime, double bitrate, double time ) : void

Informs when the user has restarted the playback.

RaisePropertyChanged ( string propertyName = "" ) : void
Reset ( ) : void

Reset basic playback parameters

Resume ( ) : void

Informs when the user has paused the playback.

Seek ( double time, double duration, string code ) : void

Detects the end user change the curren position of the video.

SetUrl ( string url ) : void

Set the used url resource.

Smartswitch ( string systemCode, string originCode, string resource, double niceNva, double niceNvb, string secretKey ) : void

Returns a JSON object with an array of different resource URLs sorted by the quality of experience they offer.

Smartswitch ( string systemCode, string originCode, string resource, double niceNva, double niceNvb, string secretKey, Action complete ) : void

Returns a JSON object with an array of different resource URLs sorted by the quality of experience they offer.

Start ( string system, string user, string pluginVersion, string code, string resource, bool live, string properties, string referer, int pingTime ) : void

Start event information.

Stop ( ) : void

Informs when the current playback has ended.

Stop ( string code, int diffTime ) : void

Informs when the current playback has ended.

Tracking ( string systemId, string userId, Microsoft.SilverlightMediaFramework.Core.SMFPlayer playerInstance ) : void

Initialize the playback and the plugin

Tracking ( string systemId, string userId, Microsoft.SilverlightMediaFramework.Core.SMFPlayer playerInstance, bool smartswitch, bool analyticsActive, bool liveFlag ) : void

Initialize the playback and the plugin

YouboraAvPlayer ( ) : System

Private Methods

Method Description
GetBitrate ( Microsoft.SilverlightMediaFramework.Core.SMFPlayer player ) : double
GetDuration ( Microsoft.SilverlightMediaFramework.Core.SMFPlayer player ) : long
GetFilename ( Microsoft.SilverlightMediaFramework.Core.SMFPlayer player ) : string
GetTitle ( Microsoft.SilverlightMediaFramework.Core.SMFPlayer player ) : string
JoinTime ( ) : void
MediaStarted ( ) : void

Call Start API and initialize some parameters.

PingTick ( object sender, EventArgs e ) : void

Launched every PingTime seconds.

Playlist_CollectionChanged ( object sender, System e ) : void

Occurs when the Playlist changes.

YouboraAvPlayerError ( string message ) : void

Register error in API and in local Log.

YouboraAvPlayerLog ( string message ) : void

Register error in local Log.

YouboraAvPlayerLog ( string title, string message, LogType type ) : void

Register error in local Log.

_smfPlayer_BufferingProgressChanged ( object sender, CustomEventArgs e ) : void

Occurs when the percent of the media being buffered changes.

_smfPlayer_DownloadProgressChanged ( object sender, CustomEventArgs e ) : void

Occurs when the percent of the media downloaded changes.

_smfPlayer_IsMutedChanged ( object sender, CustomEventArgs e ) : void

Muted Audio.

_smfPlayer_Loaded ( object sender, System e ) : void

Occurs when the media player is loeaded.

_smfPlayer_MediaCommand ( object sender, MediaCommandEventArgs e ) : void

Respond to remote controls and media keyboards

_smfPlayer_MediaFailed ( object sender, CustomEventArgs e ) : void

Occurs when the value of the CurrentState property changes.

_smfPlayer_MediaOpened ( object sender, EventArgs e ) : void

Occurs when the media stream has been validated and opened, and the file headers have been read.

_smfPlayer_PlayStateChanged ( object sender, CustomEventArgs e ) : void

Occurs when the value of the CurrentState property changes. The player buffering events (the first one is for the Join Time API call)

_smfPlayer_PlaybackBitrateChanged ( object sender, CustomEventArgs e ) : void

Playback bitrate changed.

_smfPlayer_PlaybackPositionChanged ( object sender, CustomEventArgs e ) : void

Player playback position changed.

_smfPlayer_PlaylistChanged ( object sender, CustomEventArgs e ) : void

Occurs when the Playlist changes. When the player change the playlist, renew the Code.

_smfPlayer_PlaylistItemChanged ( object sender, CustomEventArgs e ) : void

Playlist item changed. The session code identifier is returned in the data field Code. If the player is being played in a loop or playlist mode, concatenating ads with video content for example, the code needs to be updated, for each new video, as shown: code_x Where x is an integer that will increase on each new video in the playlist.For the previous given example: - l9UVBka5k2m20Q56_1 - l9UVBka5k2m20Q56_2 - l9UVBka5k2m20Q56_3 By doing this, only a single call to /data will be needed, when loading the player.

_smfPlayer_PlaylistReachedEnd ( object sender, EventArgs e ) : void

No more items in Playlist.

_smfPlayer_RetryStateChanged ( object sender, EventArgs e ) : void

Indicates that the RetryState property has changed.

_smfPlayer_ScrubbingCompleted ( object sender, CustomEventArgs e ) : void

Occurs when the user finishes changing the timeline position.

_smfPlayer_ScrubbingStarted ( object sender, CustomEventArgs e ) : void

Occurs when the user begin changing the timeline position.

_smfPlayer_Unloaded ( object sender, System e ) : void

Unload Player-

_smfPlayer_VolumeLevelChanged ( object sender, CustomEventArgs e ) : void

Player volumen level changed.

Method Details

Buffer() public method

Detects when the end user is experiencing buffering issues.
public Buffer ( double time, double duration, string code ) : void
time double Video playhead in seconds. If this value is 0, no data is saved in Nice Analytics backend
duration double Buffering duration in milliseconds. This is the time difference between: buffering end time - buffering start time
code string View code retrieved from the data call
return void

Close() public method

Reset all playback parameters
public Close ( ) : void
return void

Data() public method

Init Youbora Data.
public Data ( string system, string pluginVersion = DefaultPluginVersion ) : void
system string Your Nice PeopleAtWork account code that indicates Youbora Analytics /// which customer account you are sending the data to. This parameter will be provided by /// NicePeopleAtWork, if you don't have it yet, please contact your Customer Engineer or Support /// Agent
pluginVersion string The version of the plugin in the format described below this table. /// This parameter lets you to have a version control of new deployed plugins and see which /// users are using an older version (cached in the system), so you can force them to clean /// their cache and download the new version
return void

Data() public method

Init Youbora Data.
public Data ( string system, string pluginVersion, string user, bool live ) : void
system string Your Nice PeopleAtWork account code that indicates Youbora Analytics /// which customer account you are sending the data to. This parameter will be provided by /// NicePeopleAtWork, if you don't have it yet, please contact your Customer Engineer or Support /// Agent
pluginVersion string The version of the plugin in the format described below this table. /// This parameter lets you to have a version control of new deployed plugins and see which /// users are using an older version (cached in the system), so you can force them to clean /// their cache and download the new version
user string User identifier. If the user is unknown, send the parameter blank or with a /// default username
live bool Boolean variable to identify if the video is a live (true) or an on demand (false) stream. /// Many of our plugins have a method integrated that lets the customer, when integrating the plugin, use a method /// to set this property
return void

Error() public method

Reports a player error.
public Error ( string errorCode ) : void
errorCode string Player's error numerical code
return void

GetData() public method

public GetData ( string system, string pluginVersion = DefaultPluginVersion ) : Data
system string
pluginVersion string
return Youbora.Analytics.Models.Data.Data

Init() public method

Initialize the playback and the plugin
public Init ( string userId ) : void
userId string
return void

Join() public method

Determines the elapsed amount of time since the end user clicks/touches the player's play button until the media starts to be played.
public Join ( string time, string code ) : void
time string Time difference (in milliseconds) between the player goes from the start event /// until it finishes buffering the required amount of video bytes to start the playback. Or the amount of time /// it takes to start the playback since the user wants to watch it
code string View code retrieved from the data call
return void

Pause() public method

Informs when the user has paused the playback.
public Pause ( ) : void
return void

Ping() public method

Informs when the user has restarted the playback.
public Ping ( string pingTime, double bitrate, double time ) : void
pingTime string Elapsed ping time in seconds from the previous ping
bitrate double Current bitrate in bps (bits per second)
time double Video's current time in seconds.
return void

RaisePropertyChanged() public method

public RaisePropertyChanged ( string propertyName = "" ) : void
propertyName string
return void

Reset() public method

Reset basic playback parameters
public Reset ( ) : void
return void

Resume() public method

Informs when the user has paused the playback.
public Resume ( ) : void
return void

Seek() public method

Detects the end user change the curren position of the video.
public Seek ( double time, double duration, string code ) : void
time double Video playhead in seconds. If this is 0, no data is saved in Nice Analytics backend
duration double Seeking duration in miliseconds. This is the time difference between seek end time - seek start time
code string View code retrieved from the data call
return void

SetUrl() public method

Set the used url resource.
public SetUrl ( string url ) : void
url string url
return void

Smartswitch() public method

Returns a JSON object with an array of different resource URLs sorted by the quality of experience they offer.
public Smartswitch ( string systemCode, string originCode, string resource, double niceNva, double niceNvb, string secretKey ) : void
systemCode string Your Nice PeopleAtWork account code that indicates Youbora Smartswitch which customer account rules are going to be applied. This parameter will be provided by NicePeopleAtWork, if you don't have it yet, please contact your Customer Engineer or Support Agent.
originCode string Origin code configured in Smartswitch's Account Settings
resource string Urlencoded resource path where the file can be found inside the configured bucket
niceNva double "not valid after" parameter. It defines the timestamp (in milliseconds) after the generated URL won't be valid. This is the current UTC time + the amount of time you want, in milliseconds
niceNvb double "not valid before" parameter. It defines the timestamp (in milliseconds) that it will take that URL to be valid and accessible. This is the current UTC time + the amount of time you want, in milliseconds.
secretKey string Is a secret key shared by NicePeopleAtWork and the customer to authenticate all the calls against the Smartswitch
return void

Smartswitch() public method

Returns a JSON object with an array of different resource URLs sorted by the quality of experience they offer.
public Smartswitch ( string systemCode, string originCode, string resource, double niceNva, double niceNvb, string secretKey, Action complete ) : void
systemCode string Your Nice PeopleAtWork account code that indicates Youbora Smartswitch which customer account rules are going to be applied. This parameter will be provided by NicePeopleAtWork, if you don't have it yet, please contact your Customer Engineer or Support Agent.
originCode string Origin code configured in Smartswitch's Account Settings
resource string Urlencoded resource path where the file can be found inside the configured bucket
niceNva double "not valid after" parameter. It defines the timestamp (in milliseconds) after the generated URL won't be valid. This is the current UTC time + the amount of time you want, in milliseconds
niceNvb double "not valid before" parameter. It defines the timestamp (in milliseconds) that it will take that URL to be valid and accessible. This is the current UTC time + the amount of time you want, in milliseconds.
secretKey string
complete Action Complete Action
return void

Start() public method

Start event information.
public Start ( string system, string user, string pluginVersion, string code, string resource, bool live, string properties, string referer, int pingTime ) : void
system string Your Nice PeopleAtWork account code that indicates Youbora Analytics which customer account you are sending the data to. This parameter will be provided by NicePeopleAtWork, if you don't have it yet, please contact your Customer Engineer or Support Agent
user string User identifier. If the user is unknown, send the parameter blank or with a default username
pluginVersion string
code string View code retrieved from the data call
resource string The resource parameter corresponds to the real content URL and therefore the CDN detection is correct.
live bool Boolean variable to identify if the video is a live (true) or an on demand (false) stream. Many of our plugins have a method integrated that lets the customer, when integrating the plugin, use a method to set this property
properties string JSON media properties (see them defined below in a sub-section)
referer string Browser's URL where the player is being loaded (or window.location for Smart TV applications). This field can be empty but must be declared.
pingTime int The version of the plugin in the x.x.x_pluginCode format. This parameter lets you to have a version control of new deployed plugins and see which users are using an older version (cached in the system), so you can force them to clean their cache and download the new version
return void

Stop() public method

Informs when the current playback has ended.
public Stop ( ) : void
return void

Stop() public method

Informs when the current playback has ended.
public Stop ( string code, int diffTime ) : void
code string View code retrieved from the data call
diffTime int Should be more or less 5000ms if pingTime is 5s by default
return void

Tracking() public method

Initialize the playback and the plugin
public Tracking ( string systemId, string userId, Microsoft.SilverlightMediaFramework.Core.SMFPlayer playerInstance ) : void
systemId string your NicePeopleAtWork account code that indicates Youbora Analytics which /// customer account the data is sent to.This will be provided by NicePeopleAtWork, if you don’t have it yet, /// please ask it to your Customer Engineering Manager or Support Agent.
userId string user ID value inside your system. Leave it blank if you don't want to use it. /// This will help you to easily identify your users inside Youbora Analytics and filter all that user's views.
playerInstance Microsoft.SilverlightMediaFramework.Core.SMFPlayer it is an instance of SMFPlayer initialized with a resource.
return void

Tracking() public method

Initialize the playback and the plugin
public Tracking ( string systemId, string userId, Microsoft.SilverlightMediaFramework.Core.SMFPlayer playerInstance, bool smartswitch, bool analyticsActive, bool liveFlag ) : void
systemId string your NicePeopleAtWork account code that indicates Youbora Analytics which /// customer account the data is sent to.This will be provided by NicePeopleAtWork, if you don’t have it yet, /// please ask it to your Customer Engineering Manager or Support Agent.
userId string user ID value inside your system. Leave it blank if you don't want to use it. /// This will help you to easily identify your users inside Youbora Analytics and filter all that user's views.
playerInstance Microsoft.SilverlightMediaFramework.Core.SMFPlayer it is an instance of SMFPlayer initialized with a resource.
smartswitch bool Enable the use of smartswitch
analyticsActive bool It enables or disables all the Analytics module features
liveFlag bool lets analytics identify if the user is playing a Live or VoD content.
return void

YouboraAvPlayer() public method

public YouboraAvPlayer ( ) : System
return System