Tutorial: Work with Electronic Program Guide manager

Work with Electronic Program Guide manager

Make sure data collection is enabled:

stbEpgManager.enable = true;

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

var streamUrl = 'rtp://228.1.1.11:1234',
    channelId = 'C_4601_634000';

// legacy
gSTB.Play(streamUrl);
gSTB.Play(channelId);

// new recommended approach
stbPlayerManager.list[0].play({uri: streamUrl});
stbPlayerManager.list[0].play({uri: channelId});

After EPG data is received get present and following program info for specified channel:

console.log('EPG data:', stbEpgManager.getBrief({id: streamUrl}));
console.log('EPG data:', stbEpgManager.getBrief({id: channelId}));

Get program info for a given time period for specified channel:

console.log('full schedule:', stbEpgManager.getSchedule({id: streamUrl}));

console.log('given time range:', stbEpgManager.getSchedule({
    id:    channelId,
    start: 1428307972,
    end:   1428329461
}));

console.log('full schedule from the given start time:', stbEpgManager.getSchedule({
    id:    streamUrl,
    start: 1428307972
}));

console.log('full schedule till the given end time:', stbEpgManager.getSchedule({
    id:  channelId,
    end: 1428329461
}));

Detect EPG data update with one of the following methods:

// legacy
window.stbEvent = {
    onEvent: function ( event, info ) {
        if ( Number(event) === 42 ) {
            console.log('EPG info is updated. Updated info:', info);
            // {id: 'T2_11_650000', brief: true}
        }
    }
};

// new recommended approach
stbEpgManager.onEpgInfo = function ( data ) {
    console.log('EPG info is updated. Updated data:', data);
    // {id: 'T2_11_650000', brief: true}
}