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(stbEpgManager.getBrief({id: streamUrl}));
console.log(stbEpgManager.getBrief({id: channelId}));

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

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

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

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

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

Detect EPG data update with one of the following methods:

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

// new recommended approach
stbEpgManager.onEpgInfo = function ( data ) {
    console.log('EPG info is updated.');
}