User Tools

Site Tools


Sidebar

Translations of this page:

Contacts Us

  • Contact Us

en:stb_webkit:faq:timeshift_api_v3

TimeShiftAPI v3

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 main step to initiate timeshift.

It is enough to done this one time after start.

  • 2. If it is necessary, change max duration of timeshift using SetTimeShiftDurationMax. By default 7200 seconds.
  • 3. Start playback with solution extTimeShift.

All actions with timeshift are done using global object TimeShift

Command Stop or launching other content to play automatically frees 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 Description
1 playback
2 stop
3 SetSlidingMode(1), when playback was in timeshift mode on pause and current position differs from realtime position more that 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 storage device is not available (event_data=1) or there is no free space (event_data=2). After this event playback will automaticly switch in real time

Method of object TimeShift

TimeShift.SetTimeShiftFolder

void SetTimeShiftFolder(string folderPath)

Set working directory for 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 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 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 variant – false.

Note:

Works only if playback was started using solution extTimeShift.

TimeShift.ExitTimeShiftAndSave

void ExitTimeShiftAndSave(string name)

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

Parameters:

Parameters Available values Description
name Sub directory name, where all saved data for current timeshift will be stored

Return value:

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

TimeShift. ExitTimeShiftAndSaveDuration

void ExitTimeShiftAndSaveDuration(string name, int duration)

Exit from timeshift mode and stop playback. Current timeshift buffer will be saved as PVR task in file with 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 Sub directory name, where all saved data for current timeshift will be stored
duration >= 0 Time in seconds, while what it is necessary to save stream.

Return value:

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

TimeShift. SetSlidingMode

void SetSlidingMode(bool OnOff);

Parameters:

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

Return value:

No.

en/stb_webkit/faq/timeshift_api_v3.txt · Last modified: 2019/05/17 11:23 (external edit)