Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/release52' into bbc-release52
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterC89 committed Nov 27, 2024
2 parents a240f33 + ad41ae6 commit 9a9bbda
Show file tree
Hide file tree
Showing 14 changed files with 273 additions and 3 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,15 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline

### [9.2.0-release52](https://github.com/nrkno/tv-automation-state-timeline-resolver/compare/9.1.0...9.2.0-release52) (2024-08-19)

## [9.2.0](https://github.com/nrkno/sofie-timeline-state-resolver/compare/9.2.0-alpha.0...9.2.0) (2024-10-07)


### Bug Fixes

* revert quantel device to release50 version ([36817aa](https://github.com/nrkno/sofie-timeline-state-resolver/commit/36817aadcd0d0657bfa6175a3b333b1bf9e2c798))



## [9.2.0-alpha.0](https://github.com/nrkno/sofie-timeline-state-resolver/compare/9.1.0...9.2.0-alpha.0) (2024-09-09)


Expand Down
4 changes: 4 additions & 0 deletions packages/quick-tsr/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline

### [9.2.0-release52](https://github.com/nrkno/sofie-timeline-state-resolver/compare/9.1.0...9.2.0-release52) (2024-08-19)

## [9.2.0](https://github.com/nrkno/sofie-timeline-state-resolver/compare/9.2.0-alpha.0...9.2.0) (2024-10-07)

**Note:** Version bump only for package quick-tsr

## [9.2.0-alpha.0](https://github.com/nrkno/sofie-timeline-state-resolver/compare/9.1.0...9.2.0-alpha.0) (2024-09-09)

**Note:** Version bump only for package quick-tsr
Expand Down
2 changes: 2 additions & 0 deletions packages/timeline-state-resolver-types/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline

### [9.2.0-release52](https://github.com/nrkno/sofie-timeline-state-resolver/compare/9.1.0...9.2.0-release52) (2024-08-19)

## [9.2.0](https://github.com/nrkno/sofie-timeline-state-resolver/compare/9.2.0-alpha.0...9.2.0) (2024-10-07)

**Note:** Version bump only for package timeline-state-resolver-types

## [9.2.0-alpha.0](https://github.com/nrkno/sofie-timeline-state-resolver/compare/9.1.0...9.2.0-alpha.0) (2024-09-09)
Expand Down
13 changes: 13 additions & 0 deletions packages/timeline-state-resolver-types/src/integrations/vmix.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ export enum VMixCommand {
LIST_ADD = 'LIST_ADD',
LIST_REMOVE_ALL = 'LIST_REMOVE_ALL',
RESTART_INPUT = 'RESTART_INPUT',
BROWSER_NAVIGATE = 'BROWSER_NAVIGATE',
SELECT_INDEX = 'SELECT_INDEX',
}

export type TimelineContentVMixAny =
Expand Down Expand Up @@ -188,6 +190,16 @@ export interface TimelineContentVMixInput extends TimelineContentVMixBase {

/** If media should start from the beginning or resume from where it left off */
restart?: boolean

/** The URL for Browser input */
url?: string

/**
* Photos, List: Selects item in List
* Virtual Set: Zooms to selected preset using the current speed settings
* starts from 1
*/
index?: number
}

export interface TimelineContentVMixOutput extends TimelineContentVMixBase {
Expand Down Expand Up @@ -325,4 +337,5 @@ export enum VMixInputType {
Flash = 'Flash',
PowerPoint = 'PowerPoint',
List = 'List',
Browser = 'Browser',
}
6 changes: 6 additions & 0 deletions packages/timeline-state-resolver/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline

**Note:** Version bump only for package timeline-state-resolver

## [9.2.0](https://github.com/nrkno/tv-automation-state-timeline-resolver/compare/9.2.0-alpha.0...9.2.0) (2024-10-07)

### Bug Fixes

- revert quantel device to release50 version ([36817aa](https://github.com/nrkno/tv-automation-state-timeline-resolver/commit/36817aadcd0d0657bfa6175a3b333b1bf9e2c798))

## [9.2.0-alpha.0](https://github.com/nrkno/tv-automation-state-timeline-resolver/compare/9.1.0...9.2.0-alpha.0) (2024-09-09)

### Features
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import * as _ from 'underscore'

/**
* Note: This work is derived from
* http://www.pharoscontrols.com/assets/documentation/manuals/Pharos%20Designer%202%20User%20Manual%20-%20A4.pdf
* https://dl.pharoscontrols.com/documentation/manuals/Pharos%20Designer%202%20User%20Manual%20-%20A4.pdf
*/

// This should probably be moved into it's own library
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,7 @@ export class SisyfosMessageDevice extends DeviceWithState<SisyfosState, DeviceOp
debug('reset channel ' + index)
commands.push({
context: `Channel ${index} reset`,
content: {
command: {
type: SisyfosCommandType.SET_CHANNEL,
channel: Number(index),
values: newChannel,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,4 +92,33 @@ describe('VMixCommandSender', () => {
value: 1.5,
})
})

it('sends url', async () => {
const { sender, mockConnection } = createTestee()
await sender.sendCommand({
command: VMixCommand.BROWSER_NAVIGATE,
input: 5,
value: 'https://example.com',
})

expect(mockConnection.sendCommandFunction).toHaveBeenCalledTimes(1)
expect(mockConnection.sendCommandFunction).toHaveBeenLastCalledWith('BrowserNavigate', {
input: 5,
value: 'https%3A%2F%2Fexample.com',
})
})
it('selects index', async () => {
const { sender, mockConnection } = createTestee()
await sender.sendCommand({
command: VMixCommand.SELECT_INDEX,
input: 5,
value: 3,
})

expect(mockConnection.sendCommandFunction).toHaveBeenCalledTimes(1)
expect(mockConnection.sendCommandFunction).toHaveBeenLastCalledWith('SelectIndex', {
input: 5,
value: 3,
})
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -146,4 +146,47 @@ describe('VMixStateDiffer', () => {
cropBottom: 0.8,
})
})

it('sets browser url', () => {
const differ = createTestee()

const oldState = makeMockFullState()
const newState = makeMockFullState()

oldState.reportedState.existingInputs['99'] = differ.getDefaultInputState(99)

newState.reportedState.existingInputs['99'] = differ.getDefaultInputState(99)
const url = 'https://example.com'
newState.reportedState.existingInputs['99'].url = url

const commands = differ.getCommandsToAchieveState(Date.now(), oldState, newState)

expect(commands.length).toBe(1)
expect(commands[0].command).toMatchObject({
command: VMixCommand.BROWSER_NAVIGATE,
input: '99',
value: url,
})
})
it('sets index', () => {
const differ = createTestee()

const oldState = makeMockFullState()
const newState = makeMockFullState()

oldState.reportedState.existingInputs['99'] = differ.getDefaultInputState(99)

newState.reportedState.existingInputs['99'] = differ.getDefaultInputState(99)
const index = 3
newState.reportedState.existingInputs['99'].index = index

const commands = differ.getCommandsToAchieveState(Date.now(), oldState, newState)

expect(commands.length).toBe(1)
expect(commands[0].command).toMatchObject({
command: VMixCommand.SELECT_INDEX,
input: '99',
value: index,
})
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
TimelineContentTypeVMix,
TimelineContentVMixAny,
VMixInputType,
VMixTransitionType,
} from 'timeline-state-resolver-types'
import { VMixTimelineStateConverter } from '../vMixTimelineStateConverter'
import { VMixOutput, VMixStateDiffer } from '../vMixStateDiffer'
Expand Down Expand Up @@ -136,6 +137,114 @@ describe('VMixTimelineStateConverter', () => {
expect(result.reportedState.inputsAddedByUsAudio[prefixAddedInput(filePath)]).toBeUndefined()
})

it('allows overriding transitions in usual layer order', () => {
const converter = createTestee()
const result = converter.getVMixStateFromTimelineState(
wrapInTimelineState({
pgm0: wrapInTimelineObject('pgm0', {
deviceType: DeviceType.VMIX,
type: TimelineContentTypeVMix.PROGRAM,
input: 2,
}),
pgm1: wrapInTimelineObject('pgm1', {
deviceType: DeviceType.VMIX,
type: TimelineContentTypeVMix.PROGRAM,
transition: {
duration: 500,
effect: VMixTransitionType.Fade,
},
}),
}),
{
pgm0: wrapInMapping({
mappingType: MappingVmixType.Program,
}),
pgm1: wrapInMapping({
mappingType: MappingVmixType.Program,
}),
}
)
expect(result.reportedState.mixes[0]?.transition).toEqual({
duration: 500,
effect: VMixTransitionType.Fade,
})
expect(result.reportedState.mixes[0]?.program).toEqual(2)
})

it('does not allow overriding transitions in reverse layer order', () => {
const converter = createTestee()
const result = converter.getVMixStateFromTimelineState(
wrapInTimelineState({
pgm0: wrapInTimelineObject('pgm0', {
deviceType: DeviceType.VMIX,
type: TimelineContentTypeVMix.PROGRAM,
transition: {
duration: 500,
effect: VMixTransitionType.Fade,
},
}),
pgm1: wrapInTimelineObject('pgm1', {
deviceType: DeviceType.VMIX,
type: TimelineContentTypeVMix.PROGRAM,
input: 2,
}),
}),
{
pgm0: wrapInMapping({
mappingType: MappingVmixType.Program,
}),
pgm1: wrapInMapping({
mappingType: MappingVmixType.Program,
}),
}
)
expect(result.reportedState.mixes[0]?.transition).toEqual({
duration: 0,
effect: VMixTransitionType.Cut,
})
expect(result.reportedState.mixes[0]?.program).toEqual(2)
})
it('supports url', () => {
const converter = createTestee()
const url = 'https://example.com'
const result = converter.getVMixStateFromTimelineState(
wrapInTimelineState({
inp0: wrapInTimelineObject('inp0', {
deviceType: DeviceType.VMIX,
url,
type: TimelineContentTypeVMix.INPUT,
}),
}),
{
inp0: wrapInMapping({
mappingType: MappingVmixType.Input,
index: '1',
}),
}
)
expect(result.reportedState.existingInputs['1'].url).toEqual(url)
})
it('supports index', () => {
const converter = createTestee()
const index = 3
const result = converter.getVMixStateFromTimelineState(
wrapInTimelineState({
inp0: wrapInTimelineObject('inp0', {
deviceType: DeviceType.VMIX,
index,
type: TimelineContentTypeVMix.INPUT,
}),
}),
{
inp0: wrapInMapping({
mappingType: MappingVmixType.Input,
index: '1',
}),
}
)
expect(result.reportedState.existingInputs['1'].index).toEqual(index)
})

// TODO: maybe we can't trust the defaults when adding an input? Make this test pass eventually
// it('tracks audio state for mapped inputs added by us', () => {
// const converter = createTestee()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,10 @@ export class VMixCommandSender {
return this.listRemoveAll(command.input)
case VMixCommand.RESTART_INPUT:
return this.restart(command.input)
case VMixCommand.BROWSER_NAVIGATE:
return this.browserNavigate(command.input, command.value)
case VMixCommand.SELECT_INDEX:
return this.selectIndex(command.input, command.value)
default:
throw new Error(`vmixAPI: Command ${((command || {}) as any).command} not implemented`)
}
Expand Down Expand Up @@ -467,6 +471,14 @@ export class VMixCommandSender {
return this.sendCommandFunction(`Restart`, { input })
}

public async browserNavigate(input: string | number, value: string): Promise<any> {
return this.sendCommandFunction(`BrowserNavigate`, { input, value: encodeURIComponent(value) })
}

public async selectIndex(input: string | number, value: number): Promise<any> {
return this.sendCommandFunction(`SelectIndex`, { input, value })
}

private async sendCommandFunction(func: string, args: SentCommandArgs) {
return this.vMixConnection.sendCommandFunction(func, args)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,16 @@ export interface VMixStateCommandRestart extends VMixStateCommandBase {
command: VMixCommand.RESTART_INPUT
input: string | number
}
export interface VMixStateCommandBrowserNavigate extends VMixStateCommandBase {
command: VMixCommand.BROWSER_NAVIGATE
input: string | number
value: string
}
export interface VMixStateCommanSelectIndex extends VMixStateCommandBase {
command: VMixCommand.SELECT_INDEX
input: string | number
value: number
}
export type VMixStateCommand =
| VMixStateCommandPreviewInput
| VMixStateCommandTransition
Expand Down Expand Up @@ -248,6 +258,8 @@ export type VMixStateCommand =
| VMixStateCommandListAdd
| VMixStateCommandListRemoveAll
| VMixStateCommandRestart
| VMixStateCommandBrowserNavigate
| VMixStateCommanSelectIndex

export enum CommandContext {
None = 'none',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ export interface VMixInput {
layers?: VMixLayers
listFilePaths?: string[]
restart?: boolean
url?: string
index?: number
}

export interface VMixInputAudio {
Expand Down Expand Up @@ -583,6 +585,28 @@ export class VMixStateDiffer {
timelineId: '',
})
}
if (input.url !== undefined && oldInput.url !== input.url) {
commands.push({
command: {
command: VMixCommand.BROWSER_NAVIGATE,
input: key,
value: input.url,
},
context: CommandContext.None,
timelineId: '',
})
}
if (input.index !== undefined && oldInput.index !== input.index) {
commands.push({
command: {
command: VMixCommand.SELECT_INDEX,
input: key,
value: input.index,
},
context: CommandContext.None,
timelineId: '',
})
}
return { preTransitionCommands, postTransitionCommands }
}

Expand Down
Loading

0 comments on commit 9a9bbda

Please sign in to comment.