class MAGES::Recorder::Player¶
Overview¶
Responsible for playing back a recording (XREC file). More…
class Player: public MonoBehaviour
{
public:
// classes
class PacketState;
class ScheduledAction;
// properties
string CurrentFilePath;
double Current01;
double EndRTSS;
double Cursor;
double CursorRate;
bool Paused;
bool IsReplaying;
UnityEvent OnRunChanged;
// methods
async Task<(bool Success, string Status)> LoadAsync(
string filePath,
System.Action onUpdate
);
void Play();
void LoadAndPlay(string filePath);
void Stop();
void SetPaused(bool on);
void Schedule(System.Action action, double forTime);
};
Detailed Documentation¶
Responsible for playing back a recording (XREC file).
Properties¶
string CurrentFilePath
Gets the current file path.
double Current01
Gets the current playback position as a fraction of the total duration.
double EndRTSS
Gets the end of the recording in RTSS.
double Cursor
Gets the current playback position in RTSS.
double CursorRate
Gets or sets the rate at which the cursor moves. 1.0 is normal speed, 0.5 is half speed, etc.
bool Paused
Gets a value indicating whether the player is paused.
bool IsReplaying
Gets a value indicating whether the player is currently replaying a recording.
UnityEventOnRunChanged
Gets the event that is triggered when the player is paused or unpaused.
True when paused.
Methods¶
async Task<(bool Success, string Status)> LoadAsync(
string filePath,
System.Action onUpdate
)
Loads a recording file asynchronously and prepares the player for playback.
Parameters:
filePath |
The path to the file. |
onUpdate |
The action to be called on each update. |
Returns:
Returns the async modifier for waiting.
void Play()
Plays the recording from the beginning.
void LoadAndPlay(string filePath)
Loads a recording and starts playing it.
Parameters:
filePath |
The file to play from. |
void Stop()
Stops the player.
void SetPaused(bool on)
Set the player to paused or unpaused.
Parameters:
on |
True for paused, false for unpaused. |
void Schedule(System.Action action, double forTime)
Schedules an action to be run around a specific time in the cursor.
Parameters:
action |
The action to run. |
forTime |
The point in time where it has to be run. |