@devultur/core 1.0.2 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1143,6 +1143,12 @@ interface HandleWebhookOptions {
1143
1143
  patch: PatchFn;
1144
1144
  read: ReadFn;
1145
1145
  }
1146
+ /**
1147
+ * Applies a media Worker event to your media record through `read` / `patch`.
1148
+ *
1149
+ * `transcode.complete` waits in "captioning" only when the record has `captionsPending: true` (set it when you
1150
+ * request captions); otherwise the video goes straight to "ready". `captions.complete` clears `captionsPending`.
1151
+ */
1146
1152
  declare function handleWebhook({ event, recordId, patch, read }: HandleWebhookOptions): Promise<void>;
1147
1153
  declare function createHTTPWebhookHandler(options: {
1148
1154
  secret: string;
package/dist/index.js CHANGED
@@ -1603,9 +1603,9 @@ async function handleWebhook({ event, recordId, patch, read }) {
1603
1603
  break;
1604
1604
  case MediaEventName.TRANSCODE_COMPLETE: {
1605
1605
  const record = await read(recordId);
1606
- const hasCaptions = (record?.captionLocales?.length ?? 0) > 0;
1606
+ const isWaitingForCaptions = record?.captionsPending === true;
1607
1607
  await patch(recordId, {
1608
- transcodeStatus: hasCaptions ? MediaStatus.READY : MediaStatus.CAPTIONING,
1608
+ transcodeStatus: isWaitingForCaptions ? MediaStatus.CAPTIONING : MediaStatus.READY,
1609
1609
  transcodeProgress: void 0,
1610
1610
  duration: event.duration,
1611
1611
  playlistUrl: event.playlistKey,
@@ -1623,7 +1623,8 @@ async function handleWebhook({ event, recordId, patch, read }) {
1623
1623
  const hasPlaylist = !!record?.playlistUrl;
1624
1624
  await patch(recordId, {
1625
1625
  transcodeStatus: hasPlaylist ? MediaStatus.READY : MediaStatus.TRANSCODING,
1626
- captionLocales: event.locales
1626
+ captionLocales: event.locales,
1627
+ captionsPending: false
1627
1628
  });
1628
1629
  break;
1629
1630
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devultur/core",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "Shared config, types, storage path conventions, media references and URL signing for the Devultur media SDKs",
5
5
  "keywords": [
6
6
  "media",