Tutorial: Work with Digital Video Broadcasting

Work with Digital Video Broadcasting

Get array of all available instances in the system:

console.log(stbDvbManager.list);

Get first available input:

var input = stbDvbManager.list[0];

Manual control of antenna power state:

// turn on
input.antennaPower = true;

// turn off
input.antennaPower = false;

Get information about input:

// current state of this tunner
console.log(input.state);

// signal level
console.log(input.signalLevel);

// signal quality
console.log(input.signalQuality);

// get supported scan types for this tunner
console.log(input.supportedScanTypes);

// get currently supported scan types for this tunner
console.log(input.currentScanTypes);

// get bit error rate
console.log(input.bitErrorRate);

Set current scan type for this input:

// DVB-C signal
console.log(input.setSignalType(1));

// DVB-T signal
console.log(input.setSignalType(2));

// DVB-T2 signal (not available for MAG270)
console.log(input.setSignalType(3));

// DVB-S/DVB-S2 signal
console.log(input.setSignalType(4));

Set event listeners to handle received data:

input.onScanProgress = function ( info ) {
    console.log('DVB channels scanning is in progress.');
};

input.onChannelFound = function ( info ) {
    console.log('DVB channel is found.');
};

input.onAntennaPower = function ( info ) {
    console.log('DVB antenna is powered off.');
};

Start channel scanning (parameters explanation see in stbDvbInput.startScan method):

input.startScan({
    from: 10,
    to: 100,
    type: 2,
    bandwidth: 6,
    step: 5,
    modulation: 0,
    scanMode: 0,
    frequency: 12,
    networkId: 0
});

Tune receiver to specified frequency (parameters explanation see in stbDvbInput.tune method):

input.tune({
    frequency: 10,
    polarization: 'V',
    symbolRate: 2,
    type: 2
});

Stop channel scan:

input.stopScan();

Make a new channel list as a subset of parent list:

var channelList1, channelList2;

// any channel with LCN less then 123
channelList1 = stbDvbManager.createChannelList(['lt', 'channelNumber', 123]);
console.log(channelList1);

channelList2 = stbDvbManager.createChannelList();
console.log(channelList2);

Root list of all available channels from all inputs:

console.log(stbDvbManager.channelList);

Get the channel index in this channel list:

channelList2.add(channelList1.getChannel('123').id);

Remove the given channel from this channel list with check operation status:

if ( !channelList2.remove('ccid:0.12.1') ) {
    console.log('Was not able to remove a channel!');
}

if ( !channelList2.remove(5) ) {
    console.log('Was not able to remove a channel!');
}

Get channel detailed info:

console.log(channelList2.getChannel(5));
console.log(channelList2.getChannel('ccid:0.12.1'));

Get channel range:

console.log(channelList2.slice(1, 5));

Get the channel index in this channel list:

console.log(channelList2.indexOf('ccid:0.12.1'));

Remove all channels from this channel list:

channelList2.clear();