Skip to content

🎥 Make videos programmatically with React

get location

Jonny Burger39785723dc6a
diff --git a/packages/studio/src/helpers/calculate-timeline.ts b/packages/studio/src/helpers/calculate-timeline.ts
index 9041a43238..cba2961141 100644
--- a/packages/studio/src/helpers/calculate-timeline.ts
+++ b/packages/studio/src/helpers/calculate-timeline.ts
@@ -1,4 +1,5 @@
import type {TSequence} from 'remotion';
+import {getLocationOfSequence} from './get-location-of-sequence';
import {
getCascadedStart,
getTimelineVisibleDuration,
@@ -94,6 +95,9 @@ export const calculateTimeline = ({
const uniqueTracks: TrackWithHash[] = [];
for (const track of tracks) {
+ const location = getLocationOfSequence(track.sequence.stack);
+ console.log(location);
+
if (
!uniqueTracks.find((t) => t.hash === track.hash) &&
track.sequence.showInTimeline &&
diff --git a/packages/studio/src/helpers/get-location-of-sequence.ts b/packages/studio/src/helpers/get-location-of-sequence.ts
new file mode 100644
index 0000000000..e2368a3ce8
--- /dev/null
+++ b/packages/studio/src/helpers/get-location-of-sequence.ts
@@ -0,0 +1,21 @@
+import {parseStack} from '../error-overlay/react-overlay/utils/parser';
+
+export const getLocationOfSequence = (stack: string | null) => {
+ if (!stack) {
+ return null;
+ }
+
+ const parsed = parseStack(stack.split('\n'));
+ let i = 0;
+ while (i < parsed.length) {
+ const frame = parsed[i];
+ if (frame.functionName === 'apply') {
+ i++;
+ continue;
+ }
+
+ return frame;
+ }
+
+ return null;
+};