Tutorial: Work with Digital Video Broadcasting

Work with Digital Video Broadcasting

Get array of all available instances in the system:

console.log('array of all available instances in the system:', stbDvbManager.inputs);

Get the first available input:

var input = stbDvbManager.inputs[0];

Get information about whether input can change antennaPower:

console.log('information about whether input can change "antennaPower":', input.capabilities.antennaPower);

Manual control of antenna power state:

// turn on
input.antennaPower = true;

// turn off
input.antennaPower = false;

Get information about input:

console.log('current state of this tuner:', input.state);

console.log('signal level:', input.signalLevel);

console.log('signal quality:', input.signalQuality);

console.log('supported scan types for this tuner:', input.supportedScanTypes);

console.log('currently supported scan types for this tuner:', input.currentScanTypes);

console.log('bit error rate:', input.bitErrorRate);

Set current scan type for this input:

console.log('DVB-C set signal type:', input.setSignalType(1));

console.log('DVB-T set signal type:', input.setSignalType(2));

console.log('DVB-T2  set signal type (not available for MAG270):', input.setSignalType(3));

console.log('DVB-S/DVB-S2  set signal type:', input.setSignalType(4));

Set event listeners to handle received data:

input.onScanProgress = function ( info ) {
    console.log('DVB channels scanning is in progress:', info);
    // {"state":"searching","channel":0,"frequency":51000,"progress":0,"inputIndex":0,"polarization":"H"}
};

input.onChannelFound = function ( info ) {
    console.log('DVB channel is found:', info);
    // {"frequency":474000,"inputIndex":0,"bandwidth":4000,"polarization":"H","modulation":-1,"symbolRate":6875800,"id":"C.0.000474.06875-01","type":1,"uri":"dvb://C.0.000474.06875-01","scrambled":false,"name":"MEGA","provider":"","isRadio":false,"channelNumber":0}
};

input.onAntennaPower = function () {
    console.log('DVB antenna power is 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();

Root list with all available channels from all inputs:

console.log('root list with all available channels from all inputs:', stbDvbManager.channelList);

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

var channelList1, channelList2;

channelList1 = stbDvbManager.createChannelList(['lt', 'channelNumber', 123]);
console.log('any channels with LCN less than 123:', channelList1);

channelList2 = stbDvbManager.createChannelList([], stbDvbManager.channelList);
console.log('all channels without filters:', channelList2);

Get size of list:

console.log('list size:', channelList1.size);

Add channel to the list:

channelList2.add(channelList1.get(123).id);

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

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

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

Get channel detailed info:

console.log('channel detailed info:', channelList2.getChannel(5));
console.log('channel detailed info:', channelList2.getChannel('ccid:0.12.1'));

Get channel range:

console.log('channel range:', channelList2.slice(1, 5));

Get the channel index in this channel list:

console.log('the channel index in this channel list:', channelList2.indexOf('ccid:0.12.1'));

Remove all channels from this channel list:

channelList2.clear();

Preload the given channel to faster start playing:

stbDvbManager.loadChannel(channelList2.get(0));

Unload from preloaded cache the given channel:

stbDvbManager.unloadChannel(channelList2.get(0));

Unload from preloaded cache all channels:

stbDvbManager.unloadAllChannels();

Get array of all available tuners in the system:

console.log('array of all available tuners in the system:', stbDvbManager.tuners);

Play channel:

var player  = stbPlayerManager.list[0],
    channel = channelList2.get(0);

player.play({
    uri: channel.uri,
    solution: 'dvb'
});

Get first available input:

var tuner = stbDvbManager.tuners[0];

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

tuner.tune({
    frequency: 50000
});

tuner.tune(channelList2.get(0));

Untune receiver:

tuner.untune();

Link this tuner to the given input:

tuner.moveToInput(input);

Get current input number of this tuner:

console.log('current input number of this tuner:', tuner.inputIndex);

Get players count which used this tuner:

console.log('players count which used this tuner:', tuner.playersCount);

Get Bit Error Rate:

console.log('Bit Error Rate:', tuner.bitErrorRate);

Get information about signal quality:

console.log('information about signal quality:', tuner.signalQuality);

Get information about signal level:

console.log('information about signal level:', tuner.signalLevel);

Get information about tuner state (see in stbDvbTuner.stateType):

console.log('information about tuner state:', tuner.state);