@dgtgroup/centoplayer-sdk
v1.2.9
Published
The CentoPlayer SDK provides useful functions to interact with CentoPlayer on Linux and WebOS (limited).
Readme
Centoplayer App SDK
Development
- run with:
npm start - browse to /test subdirectory on:
http://127.0.0.1:8080
Getting started
npm i @dgtgroup/centoplayer-sdkimport { CentoSDK } from '@dgtgroup/centoplayer-sdk';
// Wait for initialization & Cento-player info:
CentoSDK.on('initialized', (playerInfo: Cento.Info) => {
console.log('🟢 CENTO-SDK IS INITIALIZED');
console.log('🟢', playerInfo);
});Angular implementation
As the SDK emits events that are outside of Angular's Zone, they do not get picked up by Angular's change Detection. In case a rerender is required, use
ngZone.run()to trigger change detection:
CentoSDK.on('methodname', () => {
this.ngZone.run(() => {
this.myCustomFunction(value);
});
});Available methods
Implemented
centoSDK.getPlatform()
Returns the current platform information: webos, centoplayer (=linux), DEVMODE
centoSDK.getSerialNumber()
Returns the serial number of the device.
centoSDK.getPlayerInfo()
Returns information about the media player as a Cento.Info object.
centoSDK.playlistStop(preload?:boolean)
centoSDK.playlistStart()
Starts or stops the current playlist. Preload option will prepare the next item in the playlist for instant playback.
Note: WebOS supports playback of only one video at a time. Starting a new video will automatically stop any currently playing video across the entire Signage Player. Ensure you stop any playing video before starting a new one in your application.
Awaiting implementation
centoSDK.reboot()
centoSDK.refresh()
centoSDK.displayOn()
centoSDK.displayOff()
centoSDK.showConsole()
centoSDK.hideConsole()
centoSDK.getVolume()
centoSDK.setVolume(value: number)
centoSDK.openPlayerUI()
centoSDK.showKeyboard()
centoSDK.hideKeyboard()
Events
centoSDK.on('initialized', (playerinfo: Cento.Info)=>{ ... })
centoSDK.on('serial', (value:string)=>{ ... })
centoSDK.on('keydown', (e:KeyboardEvent)=>{ ... })
centoSDK.on('keyup', (e:KeyboardEvent)=>{ ... })
Serial Communication
Listening to Serial Input events (eg. qrcode scanner):
onSerial(value: string) {
console.log('Scanned value:', value);
}
const bind = this.onSerial.bind(this);
CentoSDK.on('serial', bind);
CentoSDK.off('serial', bind);Keyboard events
centoSDK.on('keydown', (evt: KeyboardEvent) => {
console.log('Key-down event:', evt);
});
centoSDK.on('keyup', (evt: KeyboardEvent) => {
console.log('Key-up event:', evt);
});