How to use the superfly-timeline.Resolver 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 / lib / Rundown.ts View on Github external
if (piece.sourceLayer.isGuestInput) {
							hasGuestItems = true
						}
					}
				}

				// add the piece to the map to make future searches quicker
				piecesLookup[piece._id] = piece
				if (piece.continuesRefId && piecesLookup[piece.continuesRefId]) {
					piecesLookup[piece.continuesRefId].continuedByRef = piece
					piece.continuesRef = piecesLookup[piece.continuesRefId]
				}
			})

			// Use the SuperTimeline library to resolve all the items within the Part
			let tlResolved = SuperTimeline.Resolver.resolveTimeline(partTimeline, { time: 0 })
			// furthestDuration is used to figure out how much content (in terms of time) is there in the Part
			let furthestDuration = 0
			_.each(tlResolved.objects, (obj) => {
				if (obj.resolved.resolved) {
					// Timeline actually has copies of the content object, instead of the object itself, so we need to match it back to the Part
					let piece = piecesLookup[obj.content.id]
					const instance = obj.resolved.instances[0]
					if (instance) {
						piece.renderedDuration = instance.end ? (instance.end - instance.start) : null

						// if there is no renderedInPoint, use 0 as the starting time for the item
						piece.renderedInPoint = instance.start ? instance.start - TIMELINE_TEMP_OFFSET : 0

						// if the duration is finite, set the furthestDuration as the inPoint+Duration to know how much content there is
						if (
							Number.isFinite(piece.renderedDuration || 0) &&