Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
timeline-state-resolver
Advanced tools
This library orchestrates and controls different devices. Its input is a timeline data structure and a layer-to-device-map. Using the input, it resolves the expected state, diffs the state against current state and sends commands to devices where necessary.
TSR is primarily developed to be used in the Playout Gateway of the Sofie project.
When developing support for new devices, a helpful tool for quickly trying out new functionality is the Quick-TSR repo.
Install yarn https://yarnpkg.com
Install dependencies
yarn
Build:
yarn build
Run test & view coverage
yarn cov
Here follows some examples of valid mappings and timeline-objects to control devices with TSR.
Play the video clip "AMB" for 5 seconds
// Mapping:
{
myLayerCaspar: {
device: DeviceType.CASPARCG,
deviceId: 'myCCG',
channel: 1,
layer: 10
}
}
// Timeline:
{
id: 'video0',
enable: {
start: 'now',
duration: 5000
},
layer: 'myLayerCaspar',
content: {
deviceType: DeviceType.CASPARCG,
type: TimelineContentTypeCasparCg.MEDIA,
file: 'AMB'
}
}
Cut to source 2 on ME1
// Mapping:
{
myLayerME1: {
device: DeviceType.ATEM,
deviceId: 'myAtem',
mappingType: MappingAtemType.MixEffect,
index: 0
}
}
// Timeline:
{
id: 'source2',
enable: {
start: 'now'
},
layer: 'myLayerME1',
content: {
deviceType: DeviceType.ATEM,
type: TimelineContentTypeAtem.ME,
me: {
input: 2,
transition: AtemTransitionStyle.CUT
}
}
}
Start recording of a clip, and record it for 10 secods
// Mapping:
{
myLayerRecord: {
device: DeviceType.ATEM,
deviceId: 'myHyperdeck',
mappingType: MappingAtemType.MixEffect,
index: 0
}
}
// Timeline:
{
id: 'record0',
enable: {
start: 'now',
duration: 10000
},
layer: 'myLayerRecord',
content: {
deviceType: DeviceType.HYPERDECK,
type: TimelineContentTypeHyperdeck.TRANSPORT,
status: TransportStatus.RECORD,
recordFilename: 'sofie_recording1'
}
}
Pull up a fader, and leave it there
// Mapping:
{
myLayerFader0: {
device: DeviceType.LAWO,
deviceId: 'myLawo',
mappingType: MappingLawoType.SOURCE,
identifier: 'BASE'
}
}
// Timeline:
{
id: 'lawofader0',
enable: {
start: 'now'
},
layer: 'myLayerFader0',
content: {
deviceType: DeviceType.LAWO,
type: TimelineContentTypeLawo.SOURCE,
faderValue: 0
}
}
// Mapping:
{
myLayerCamera1: {
device: DeviceType.PANASONIC_PTZ,
deviceId: 'myPtz',
mappingType: MappingPanasonicPtzType.PRESET
}
}
// Timeline:
{
id: 'ptzPreset1',
enable: {
start: 'now'
},
layer: 'myLayerCamera1',
content: {
deviceType: DeviceType.PANASONIC_PTZ,
type: TimelineContentTypePanasonicPtz.PRESET,
preset: 1
}
}
// Mapping:
{
myLayerLights: {
device: DeviceType.PANASONIC_PTZ,
deviceId: 'myPtz',
mappingType: MappingPanasonicPtzType.PRESET
}
}
// Timeline:
{
id: 'scene1',
enable: {
start: 'now'
},
layer: 'myLayerLights',
content: {
deviceType: DeviceType.PHAROS,
type: TimelineContentTypePharos.SCENE,
scene: 1
}
}
Activate channel 3 on sisyfos pgm output
// Mapping:
{
myLayerSisyfosScene1: {
device: DeviceType.SISYFOS,
deviceId: 'mySisyfos',
channel: 3
}
}
// Timeline:
//ON:
{
id: 'channel3',
enable: {
start: 'now'
},
layer: 'myLayerSisyfosScene1',
content: {
deviceType: DeviceType.SISYFOS,
type: TimelineContentTypeSisyfos.SISYFOS,
isPgm: 1 // 0 = OFF, 1 = Pgm level, 2 = VoiceOver level
}
}
//FADERLEVEL:
{
id: 'channel3',
enable: {
start: 'now'
},
layer: 'myLayerSisyfosScene1',
content: {
deviceType: DeviceType.SISYFOS,
type: TimelineContentTypeSisyfos.SISYFOS,
faderLevel: 0.75
}
}
//LABEL:
{
id: 'channel3',
enable: {
start: 'now'
},
layer: 'myLayerSisyfosScene1',
content: {
deviceType: DeviceType.SISYFOS,
type: TimelineContentTypeSisyfos.SISYFOS,
label: 'SERVER B'
}
}
//VISIBLE: (shows or hide a fader)
{
id: 'channel3',
enable: {
start: 'now'
},
layer: 'myLayerSisyfosScene1',
content: {
deviceType: DeviceType.SISYFOS,
type: TimelineContentTypeSisyfos.SISYFOS,
visible: false // false: hide - true: show
}
}
Play a video for 10 seconds
// Mapping:
{
myLayerVideoA: {
device: DeviceType.QUANTEL,
deviceId: 'myQuantel',
portId: 'sofie1',
channelId: 2
}
}
// Timeline:
{
id: 'video0',
enable: {
start: 'now',
duration: 10000
},
layer: 'myLayerVideoA',
content: {
deviceType: DeviceType.QUANTEL,
title: 'myClipInQuantel'
// guid: 'abcdef872832832a2b932c97d9b2eb9' // GUID works as well
}
}
Send a POST Request to a URL
// Mapping:
{
myLayerHTTP: {
device: DeviceType.HTTPSEND,
deviceId: 'myHTTP'
}
}
// Timeline:
{
id: 'video0',
enable: {
start: 'now'
},
layer: 'myLayerHTTP',
content: {
deviceType: DeviceType.HTTPSEND,
type: TimelineContentTypeHttp.POST,
url: 'http://superfly.tv/api/report',
params: {
someRandomParameter: 42,
anotherFineParameter: 43
}
}
}
FAQs
Have timeline, control stuff
The npm package timeline-state-resolver receives a total of 1,520 weekly downloads. As such, timeline-state-resolver popularity was classified as popular.
We found that timeline-state-resolver demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.