|
1 | 1 | /* ============================================================ |
2 | | - OpenCut CEP Panel - Main Controller v1.9.33 |
| 2 | + OpenCut CEP Panel - Main Controller v1.9.34 |
3 | 3 | 6-Tab Professional Toolkit |
4 | 4 | ============================================================ */ |
5 | 5 | (function () { |
|
1386 | 1386 | removeImportedItem: function (payload, cb) { |
1387 | 1387 | var json = JSON.stringify(payload); |
1388 | 1388 | jsx("ocRemoveImportedItem('" + json.replace(/\\/g, "\\\\").replace(/'/g, "\\'") + "')", cb); |
| 1389 | + }, |
| 1390 | + setPlayhead: function (seconds, cb) { |
| 1391 | + jsx("ocSetSequencePlayhead(" + Number(seconds || 0) + ")", cb); |
1389 | 1392 | } |
1390 | 1393 | }; |
1391 | 1394 |
|
|
5005 | 5008 | return transcriptData && transcriptData.segments ? transcriptData.segments : []; |
5006 | 5009 | } |
5007 | 5010 |
|
| 5011 | + // v1.9.34 (H): jump the Premiere playhead to a transcript segment's |
| 5012 | + // start time. Quiet no-op outside Premiere so dev-mode use stays clean. |
| 5013 | + function _jumpPlayheadToSegment(idx) { |
| 5014 | + if (!inPremiere) return; |
| 5015 | + var segs = getTranscriptSegments(); |
| 5016 | + if (!segs || idx < 0 || idx >= segs.length) return; |
| 5017 | + var t = Number(segs[idx].start || 0); |
| 5018 | + if (!isFinite(t) || t < 0) return; |
| 5019 | + PremiereBridge.setPlayhead(t, function (result) { |
| 5020 | + // Only warn on errors if the first click fails; subsequent |
| 5021 | + // ones stay quiet to avoid spamming toasts on every tap. |
| 5022 | + if (!_playheadSyncWarned && result && result.indexOf("error") !== -1) { |
| 5023 | + try { |
| 5024 | + var r = JSON.parse(result); |
| 5025 | + if (r && r.error) { |
| 5026 | + _playheadSyncWarned = true; |
| 5027 | + showToast("Playhead sync unavailable: " + r.error, "warn"); |
| 5028 | + } |
| 5029 | + } catch (e) {} |
| 5030 | + } |
| 5031 | + }); |
| 5032 | + } |
| 5033 | + var _playheadSyncWarned = false; |
| 5034 | + |
5008 | 5035 | function getTranscriptTotalDuration(data) { |
5009 | 5036 | var segments = data && data.segments ? data.segments : []; |
5010 | 5037 | var maxEnd = 0; |
|
5323 | 5350 | var idx = parseInt(row.getAttribute("data-idx"), 10); |
5324 | 5351 | if (!(idx >= 0)) return; |
5325 | 5352 | focusTranscriptSegment(idx, { scroll: false, scrollTimeline: true }); |
| 5353 | + // v1.9.34 (H): jump the Premiere playhead to this segment's |
| 5354 | + // start time. Silently no-op when outside Premiere. |
| 5355 | + _jumpPlayheadToSegment(idx); |
5326 | 5356 | if (!e.target.classList.contains("transcript-seg-text")) { |
5327 | 5357 | var ta = row.querySelector(".transcript-seg-text"); |
5328 | 5358 | if (ta) ta.focus(); |
|
5339 | 5369 | var btn = e.target.closest(".transcript-timeline-seg"); |
5340 | 5370 | if (!btn) return; |
5341 | 5371 | var idx = parseInt(btn.getAttribute("data-idx"), 10); |
5342 | | - if (idx >= 0) focusTranscriptSegment(idx, { focusInput: true }); |
| 5372 | + if (idx >= 0) { |
| 5373 | + focusTranscriptSegment(idx, { focusInput: true }); |
| 5374 | + _jumpPlayheadToSegment(idx); |
| 5375 | + } |
5343 | 5376 | }); |
5344 | 5377 | el.transcriptTimeline.addEventListener("keydown", function (e) { |
5345 | 5378 | var btn = e.target.closest(".transcript-timeline-seg"); |
|
0 commit comments