Tutorial: Work with TimeShift subsystem

Work with TimeShift subsystem

TimeShift preparations:

timeShift.SetTimeShiftFolder(pathToSave1);
timeShift.SetMaxDuration(durationSec1);
timeShift.SetSlidingMode(true);

Event model initialization:

window.stbEvent = {
    onEvent: function ( event, info ) {
        if ( Number(event) === 36 ) {
            console.log('TimeShift mode is enabled. TimeShift data:', info);
        }
    }
};

Start playback of an internet stream with one of the following methods:

// legacy
gSTB.Play('extTimeShift ' + uri);

// new recommended approach
stbPlayerManager.list[0].play({uri: uri, solution: 'extTimeShift'});

Enter TimeShift mode:

timeShift.EnterTimeShift();

Different methods to exit from TimeShift mode:

// return to real-time mode:
timeShift.ExitTimeShift();

// save current TimeShift buffer via PVR:
timeShift.ExitTimeShiftAndSave(pathToSave2, fileName1);

// stop playback and save TimeShift buffer via PVR with possibility to continue recording:
timeShift.ExitTimeShiftAndSaveDuration(pathToSave3, fileName2, durationSec2);