How to use the superfly-timeline.Resolver.getState function in superfly-timeline

To help you get started, we’ve selected a few superfly-timeline examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nrkno / tv-automation-server-core / meteor / client / ui / TestTools / Timeline.tsx View on Github external
try {
		// These properties will be exposed under this.props
		// Note that these properties are reactively recalculated
		let timeline = transformTimeline(
			Timeline.find({
				studioId: props.studioId
			}, { sort: { _id: 1 } }).fetch()
		)

		// console.log('rerun')

		// TODO - dont repeat unless changed
		let tl = Resolver.resolveTimeline(timeline, { time: now })
		let allStates = Resolver.resolveAllStates(tl)

		let state = Resolver.getState(allStates, now)

		return {
			now: now,
			state: state
		}
	} catch (e) {
		return {
			now: now,
			errorMsg: `Failed to update timeline:\n${e}`
		}
	}
})(
class extends MeteorReactComponent {
github nrkno / tv-automation-server-core / meteor / server / api / playout / pieces.ts View on Github external
const objs: Array = pieces.map(piece => {
		const obj = createPieceGroup(piece)

		// If start is now, then if the part is active set it to be now, or fallback to start of the part
		if (piece.enable.start === 'now') {
			piece.enable.start = targetTime
		}

		return obj
	})

	const resolved = Resolver.resolveTimeline(transformTimeline(objs), {
		time: targetTime
	})

	const state = Resolver.getState(resolved, targetTime, 1)

	let unresolvedIds: string[] = []
	let unresolvedCount = resolved.statistics.unresolvedCount
	_.each(resolved.objects, obj0 => {
		if (!obj0.resolved.resolved || !obj0.resolved.instances || obj0.resolved.instances.length === 0) {
			const obj = obj0 as any as TimelineObjRundown
			const pieceId = (obj.metadata || {}).pieceId
			const piece = itemMap[pieceId]
			if (piece && piece.virtual) {
				// Virtuals always are unresolved and should be ignored
				unresolvedCount -= 1
			} else {
				unresolvedIds.push(obj.id)
			}
		}
	})
github nrkno / tv-automation-server-core / meteor / client / ui / NymansPlayground.tsx View on Github external
export const ComponentTimelineSimulate = withTracker(() => {

	// These properties will be exposed under this.props
	// Note that these properties are reactively recalculated
	let timeline = transformTimeline(
		Timeline.find({}, { sort: { _id: 1 } }).fetch()
	)

	// pre-process the timeline
	let now = getCurrentTimeReactive()

	let tl = Resolver.getTimelineInWindow(timeline)

	let state = Resolver.getState(tl, now)

	return {
		now: now,
		state: state
	}
})(
class extends MeteorReactComponent {