Skip navigation

Using functionality of Timeshift

To be able to fully use Timeshift functions:

1. Set directory, where temporally files will be stored using SetTimeShiftFolder . This is the main step to initiate Timeshift. It is enough to do this one time after the start.

2. If it is needed change max duration of Timeshift using SetTimeShiftDurationMax . The default value is 7200 seconds.
3. Start playback with solution extTimeShift .
All actions with timeshift are done using the global object TimeShift Command Stop or launching other content to play automatically clears Timeshift buffer.

Events

During playback using extTimeShift event 0x24 can appear. If it is so then in stbEvent.onEvent are transferred 2 parameters: event code and additional string json with next contain:

{"event_code":1,"ident":"TimeShift","event_data":""}

In this case event_code can take next values:

event_code
1 playback

2

stop
3

SetSlidingMode(1) , when playback was in Timeshift mode on pause and current position differs from a realtime position more than on maximum buffer duration of timeshift. If in pause mode event 3 appeared, then it is necessary to send Continue

4

When timeshift buffer is full. After this event in SetSlidingMode(0) mode, new data are lost and navigation is available only in buffer or switch to real-time mode (saving with resume is impossible). Event 4 while SetSlidingMode(1) means that Timeshift buffer is full and old data will start to erase itself

5 Comes before 1 minute before buffer turns full (1 minute before event 4 )
6

Comes while playback if a storage device is not available (event_data=1) or there is no free space (event_data=2) . After this event playback will automatically switch in real-time

Method of object TimeShift

TimeShift.SetTimeShiftFolder

void SetTimeShiftFolder(string folderPath)

Set the working directory for the module TimeShift . In this directory, production and reserve files will be stored.

Parameters:

Parameters Available values Description
folderPath
Path to store timeshift files

Return value:

No.

TimeShift. SetMaxDuration

void SetMaxDuration (int duration)

Set maximum Timeshift buffer duration.

Parameters:

Parameters Available values Description
duration
Max duration in seconds

Return value:

No.

TimeShift.EnterTimeShift

void EnterTimeShift()

Switch to timeshift mode. After switch pause and positioning on the current buffer will be available.

Parameters: No.

Return value:

Parameters Valid values Description
error int 0 – success 
In other variant – false.

Note: Works only if playback was started using the solution extTimeShift .

TimeShift.ExitTimeShift

void ExitTimeShift()

Exit timeshift mode and switch back to real-time. Timeshift buffer will not be saved.

Parameters:

No.

Return value:

Parameters Available values Description
error int 0 – success 
In other variants – false.

Note: Works only if playback was started using the solution extTimeShift .

TimeShift.ExitTimeShiftAndSave

void ExitTimeShiftAndSave(string name)

Exit in timeshift mode and switch to real-time. The current buffer will save as a PVR task in file with a special extension.

Parameters:

Parameters
Description
name
Subdirectory name, where all saved data for current timeshift will be stored

Return value:

Parameters Available values Description
error int 0 – success 
In other variants – false.

TimeShift. ExitTimeShiftAndSaveDuration

void ExitTimeShiftAndSaveDuration(string name, int duration)

Exit from timeshift mode and stop playback. The current timeshift buffer will be saved as a PVR task in file with a special extension. If parameter duration is set, then in addition to PVR task during duration seconds will be saved current stream.

Parameters:

Parameters Available values Description
name
Subdirectory name, where all saved data for current timeshift will be stored
duration >= 0 Time in seconds, while what it is necessary to save the stream.

Return value:

Parameters Available values Description
error int 0 – success 
In other variants – false.

TimeShift. SetSlidingMode

void SetSlidingMode(bool OnOff);

Parameters:

Parameters Available values Description
On/off
If «TRUE», timeshift buffer after reaching its end will lose old data.
If «FALSE», timeshift buffer after reaching its end will lose new data.

Return value:

No.

Need Help

Dave is an expert on the MAG STB and the author of this article.

Was this article helpful?

Yes No

Sorry to hear that.
How can we improve this article?

We use cookies in order to optimise our website, provide you with the best possible user experience and help us promote our products. Please read our Cookie Policy to find out how we use cookies and how you can control cookies.
By using this website or closing this message, you acknowledge our Privacy Policy and agree to our use of cookies as described in our Cookie Policy.