Player Events.
Playback Event.
During the playback, the following events are fired:
void OnPlayerEvent(Player_State ev, string info, long param)
{
switch (ev)
{
case Player_State.Starting: //Starting. Graph is being built
break;
case Player_State.WaitingFordata: //playback is started, but data source is timed out
break;
case Player_State.Running: //Session is running
break;
case Player_State.Paused: //Session is paused
break;
case Player_State.Stopped: //Session is stopped
break;
case Player_State.Completed: //Session is complete
break;
case Player_State.Error: //Error
break;
case Player_State.Demo_Expired: //Demo Expired
break;
case Player_State.DurationChanged: // Total duration has changed
break;
case Player_State.SegmentChanged: // Current segment changed
break;
case Player_State.SegmentListChanged: // Segment list has changed
break;
default:
break;
}
}
Error Event.
If there is an error, the player will report about it with Error event:
void OnErrorEvent(Error_Type e, string err)
{
ReportError("Error {0} - {1}", e, err);
}
PID detection.
When the player completes detection, it reports the list of PIDs found in the stream.
void OnPidDetectionEvent(List<PidInfoWr> pidList)
{
pidList.ForEach(pid =>
{
switch(pid.streamType)
{
case StreamType.VIDEO:
break;
case StreamType.KLV:
break;
case StreamType.PRIVATE_DATA:
break;
}
});
}
Note. You only need to set this event if you need this information. For simple playback it is not needed.
Sync Frame event.
When the player completes frame decoding, it reports the list of synced data packets.
void OnSyncFrameEvent(List<StreamFrameInfoWr> streamList)
{
streamList.ForEach(delegate(StreamFrameInfoWr streamFrame)
{
switch (streamFrame.streamType)
{
case StreamType.VIDEO:
{
// Here we got an uncompressed frame
VideoFrameInfoWr vf = streamFrame as VideoFrameInfoWr;
}
break;
case StreamType.KLV:
{
// Here we got a klv packet
KlvFrameInfoWr kf = streamFrame as KlvFrameInfoWr;
if (kf.duplicateCounter == 0 && kf.decodedData != null)
{
}
}
break;
case StreamType.PRIVATE_DATA:
{
// Here we got a private data packet
DataFrameInfoWr df = streamFrame as DataFrameInfoWr;
if (df.duplicateCounter == 0)
{
}
}
break;
}
});
}
Note. You only need to set this event if you need this information. For simple playback it is not needed.