payload-video-streaming 0.2.0-beta.0 → 0.2.0-beta.1

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.
Files changed (86) hide show
  1. package/README.md +174 -543
  2. package/dist/access.d.ts +35 -0
  3. package/dist/access.js +53 -0
  4. package/dist/access.js.map +1 -0
  5. package/dist/bin/args.d.ts +13 -0
  6. package/dist/bin/args.js +61 -0
  7. package/dist/bin/args.js.map +1 -1
  8. package/dist/bin/cli.js +9 -1
  9. package/dist/bin/cli.js.map +1 -1
  10. package/dist/bin/webhooks.d.ts +15 -0
  11. package/dist/bin/webhooks.js +149 -0
  12. package/dist/bin/webhooks.js.map +1 -0
  13. package/dist/collection.js +148 -1
  14. package/dist/collection.js.map +1 -1
  15. package/dist/components/BulkUploader.d.ts +16 -0
  16. package/dist/components/BulkUploader.js +226 -0
  17. package/dist/components/BulkUploader.js.map +1 -0
  18. package/dist/components/ListUploader.js +22 -0
  19. package/dist/components/ListUploader.js.map +1 -1
  20. package/dist/components/Uploader.d.ts +5 -0
  21. package/dist/components/Uploader.js +13 -4
  22. package/dist/components/Uploader.js.map +1 -1
  23. package/dist/components/VideoField.js +9 -5
  24. package/dist/components/VideoField.js.map +1 -1
  25. package/dist/components/VideoRelationshipField.d.ts +16 -0
  26. package/dist/components/VideoRelationshipField.js +106 -0
  27. package/dist/components/VideoRelationshipField.js.map +1 -0
  28. package/dist/components/WebhookStatusPanel.d.ts +6 -0
  29. package/dist/components/WebhookStatusPanel.js +143 -0
  30. package/dist/components/WebhookStatusPanel.js.map +1 -0
  31. package/dist/components/api.d.ts +7 -1
  32. package/dist/components/api.js +2 -0
  33. package/dist/components/api.js.map +1 -1
  34. package/dist/components/uploadFile.d.ts +30 -0
  35. package/dist/components/uploadFile.js +140 -0
  36. package/dist/components/uploadFile.js.map +1 -0
  37. package/dist/components/usePluginApi.d.ts +5 -0
  38. package/dist/components/useUploadQueue.d.ts +35 -0
  39. package/dist/components/useUploadQueue.js +135 -0
  40. package/dist/components/useUploadQueue.js.map +1 -0
  41. package/dist/components/useVideoUpload.d.ts +3 -7
  42. package/dist/components/useVideoUpload.js +29 -123
  43. package/dist/components/useVideoUpload.js.map +1 -1
  44. package/dist/core/provider.d.ts +16 -0
  45. package/dist/core/provider.js.map +1 -1
  46. package/dist/endpoints/index.js +38 -2
  47. package/dist/endpoints/index.js.map +1 -1
  48. package/dist/exports/client.d.ts +9 -0
  49. package/dist/exports/client.js +5 -0
  50. package/dist/exports/client.js.map +1 -1
  51. package/dist/exports/react.d.ts +12 -0
  52. package/dist/exports/react.js +7 -0
  53. package/dist/exports/react.js.map +1 -1
  54. package/dist/fields.d.ts +11 -2
  55. package/dist/fields.js +62 -2
  56. package/dist/fields.js.map +1 -1
  57. package/dist/frontend/VideoUploader.d.ts +65 -0
  58. package/dist/frontend/VideoUploader.js +260 -0
  59. package/dist/frontend/VideoUploader.js.map +1 -0
  60. package/dist/frontend/useVideoStatus.d.ts +26 -0
  61. package/dist/frontend/useVideoStatus.js +68 -0
  62. package/dist/frontend/useVideoStatus.js.map +1 -0
  63. package/dist/index.d.ts +5 -4
  64. package/dist/index.js +3 -2
  65. package/dist/index.js.map +1 -1
  66. package/dist/options.d.ts +7 -2
  67. package/dist/options.js +65 -2
  68. package/dist/options.js.map +1 -1
  69. package/dist/plugin.js +80 -1
  70. package/dist/plugin.js.map +1 -1
  71. package/dist/providers/bunny/provider.d.ts +2 -1
  72. package/dist/providers/bunny/provider.js +8 -0
  73. package/dist/providers/bunny/provider.js.map +1 -1
  74. package/dist/providers/cloudflare/provider.d.ts +2 -1
  75. package/dist/providers/cloudflare/provider.js +11 -0
  76. package/dist/providers/cloudflare/provider.js.map +1 -1
  77. package/dist/providers/mux/provider.d.ts +2 -1
  78. package/dist/providers/mux/provider.js +9 -0
  79. package/dist/providers/mux/provider.js.map +1 -1
  80. package/dist/service.d.ts +28 -1
  81. package/dist/service.js +114 -4
  82. package/dist/service.js.map +1 -1
  83. package/dist/types.d.ts +155 -1
  84. package/dist/types.js +1 -1
  85. package/dist/types.js.map +1 -1
  86. package/package.json +2 -1
package/dist/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/types.ts"],"sourcesContent":["import type { VideoBlockArgs } from './blocks.js'\nimport type { CollectionConfig, PayloadRequest, TaskConfig } from 'payload'\n\nimport type { DirectUpload, PlaybackUrls, VideoProvider } from './core/provider.js'\nimport type { VideoStatus } from './core/status.js'\n\n/** The shape of a video document stored by the plugin. */\nexport type VideoDoc = {\n allowedOrigins?: null | string[]\n /** Provider id and asset id joined (`cloudflare:abc…`); unique, maintained by the plugin. */\n assetKey?: null | string\n /** The provider's asset id (Cloudflare uid, Mux asset id, Bunny guid). */\n assetId?: null | string\n captions?: null | {\n generated?: boolean | null\n id?: null | string\n label?: null | string\n language: string\n status?: null | string\n }[]\n createdAt?: string\n creator?: null | string\n downloads?: null | {\n audio?: null | string\n audioPercent?: null | number\n mp4?: null | string\n mp4Percent?: null | number\n }\n duration?: null | number\n error?: null | { code?: null | string; message?: null | string }\n height?: null | number\n id: number | string\n lastSyncedAt?: null | string\n meta?: null | Record<string, unknown>\n /** Virtual: playback URLs, populated on read. */\n playback?: null | VideoPlayback\n /** Playback id, for providers that separate it from the asset id (Mux). */\n playbackId?: null | string\n /** Encoding progress 0–100, when the provider reports it. */\n progress?: null | number\n /** Id of the provider that stores the video, e.g. `cloudflare`. */\n provider?: null | string\n /** The provider's raw payload from the last sync (hidden). */\n providerData?: null | Record<string, unknown>\n readyAt?: null | string\n readyToStream?: boolean | null\n /** Previous asset, kept until a replacement upload is ready. */\n replacedAssetId?: null | string\n /** Playback requires a signed token. */\n signedPlayback?: boolean | null\n size?: null | number\n status?: null | VideoStatus\n /** Poster frame position in seconds. */\n thumbnailTime?: null | number\n title?: null | string\n updatedAt?: string\n uploadedAt?: null | string\n /** Pending upload id, for providers that create the asset in a second step (Mux). */\n uploadId?: null | string\n width?: null | number\n}\n\nexport type VideoAccessArgs = {\n /** The video document, when the operation targets an existing video. */\n doc?: VideoDoc\n req: PayloadRequest\n}\n\n/** Extra access check layered on top of the collection's own access control. */\nexport type VideoAccess = (args: VideoAccessArgs) => boolean | Promise<boolean>\n\nexport type VideoPluginOptions = {\n /**\n * Extra access checks. Collection access (read/create/update/delete) is always enforced first;\n * these let you restrict plugin-specific actions further.\n */\n access?: {\n /** Manage captions / downloads / sync. Default: collection `update` access. */\n manage?: VideoAccess\n /**\n * Who may receive playback URLs (including signed tokens) via the playback endpoint.\n * Default: anyone with collection `read` access to the video.\n */\n playback?: VideoAccess\n /** Create uploads / imports. Default: collection `create` access (or `update` when replacing). */\n upload?: VideoAccess\n }\n /** Collection customisation. */\n collection?: {\n /**\n * Access control for the videos collection, passed straight to Payload. Unset operations use\n * Payload's defaults (logged-in users only). For example, to show videos to visitors of a public\n * site: `{ read: () => true }`. Private videos stay protected by `signedPlayback` and\n * `access.playback`.\n */\n access?: CollectionConfig['access']\n /** Admin group label. Default: none. */\n adminGroup?: string\n /** Last chance to modify the generated collection config. */\n override?: (collection: CollectionConfig) => CollectionConfig\n /** Default: `videos` */\n slug?: string\n }\n /** Provider for new uploads when several are configured. Default: the first one. */\n defaultProvider?: string\n /** Delete the provider's asset when its document is deleted. Default: true. */\n deleteFromProvider?: boolean\n /**\n * Keeps the collection (so your schema/migrations stay stable) but disables endpoints, hooks\n * and admin components. `providers` may be empty.\n */\n disabled?: boolean\n /** Playback URL generation. */\n playback?: {\n /**\n * Extend signed tokens so they outlast the video: a video of `duration` seconds gets at least\n * `duration × factor + marginSeconds` (still capped at the provider's maximum), so a token never\n * expires while someone is watching. An explicit `expiresIn` passed to `getPlayback()` or the\n * playback endpoint takes precedence. Default `{ factor: 2, marginSeconds: 600 }`; `false` always\n * uses `expiresIn`.\n */\n coverDuration?: { factor?: number; marginSeconds?: number } | boolean\n /** Default signed token lifetime in seconds. Default 3600 (Cloudflare's maximum is 86400). */\n expiresIn?: number\n /**\n * Populate a virtual `playback` field on every read (REST, GraphQL, Local API).\n * Signed videos get a fresh token when the reader passes `access.playback`.\n * Default: true.\n */\n populateOnRead?: boolean\n }\n /** The video providers, e.g. `[cloudflareStream({ … })]`. Required unless `disabled`. */\n providers: VideoProvider[]\n /**\n * Registers a Payload jobs task that refreshes videos that are still processing. Use it when webhooks\n * aren't configured (or as a safety net), so documents reach `ready`/`error` even if nobody has the\n * admin open. Queue it yourself, or pass `cron` (or `schedule`) to run it automatically.\n */\n syncPendingTask?:\n | boolean\n | {\n /**\n * When `cron` is set, also add a `jobs.autoRun` entry for `queue` so the task runs without any\n * other configuration. Set to `false` if you run jobs yourself (e.g. a worker or `/api/payload-jobs/run`).\n * Default `true`.\n */\n autoRun?: boolean\n /** Max documents refreshed per run. Default 50. */\n batchSize?: number\n /**\n * How often to sync, as a cron expression: 5 fields, or 6 with seconds. For example\n * `'* * * * *'` (every minute) or `'*\\/5 * * * *'` (every 5 minutes). Env: `VIDEO_SYNC_CRON`.\n */\n cron?: string\n /** Jobs queue the task is scheduled on. Default `videos`. */\n queue?: string\n /** Full Payload jobs schedule. Takes precedence over `cron`/`queue`. */\n schedule?: TaskConfig['schedule']\n /** Task slug. Default `videoSyncPending`. */\n slug?: string\n }\n /** Defaults for new videos, for every provider. */\n upload?: {\n /** `creator` value stored on the video. Default: the uploading user's id. */\n creator?: (req: PayloadRequest) => string | undefined\n /** New videos require signed playback URLs. Default false. */\n signedPlayback?: boolean\n /** Default poster frame position, in seconds. */\n thumbnailTime?: number\n }\n /**\n * Register the video block in `config.blocks`, so blocks fields and Lexical can reference it by\n * slug (`videoBlockReferences('video')`, `BlocksFeature({ blocks: ['video'] })`).\n * Not needed when you use `videoBlock()` inline. Default false.\n */\n videoBlock?: boolean | Omit<VideoBlockArgs, 'collectionSlug'>\n}\n\nexport type ResolvedVideoOptions = {\n access: NonNullable<VideoPluginOptions['access']>\n collection: VideoPluginOptions['collection']\n collectionSlug: string\n defaultProvider?: string\n deleteFromProvider: boolean\n playback: {\n coverDuration: { factor: number; marginSeconds: number } | false\n expiresIn: number\n /** Longest token lifetime every configured provider accepts. */\n maxTokenTtlSeconds: number\n populateOnRead: boolean\n }\n providers: VideoProvider[]\n syncPendingTask?: {\n autoRun: boolean\n batchSize: number\n cron?: string\n queue: string\n schedule?: TaskConfig['schedule']\n slug: string\n }\n upload: {\n creator?: (req: PayloadRequest) => string | undefined\n signedPlayback: boolean\n thumbnailTime?: number\n }\n}\n\n/** Result of the playback endpoint / server API, and the virtual `playback` field. */\nexport type VideoPlayback = {\n assetId: string\n /** ISO timestamp when the signed token expires. */\n expiresAt?: string\n playbackId?: string\n provider: string\n readyToStream: boolean\n /** True when the URLs below contain a signed token. */\n signed: boolean\n /** True when the video requires signed playback URLs. */\n signedPlayback: boolean\n status: null | VideoStatus\n token?: string\n /** null when the video requires signed URLs but the reader may not receive a token. */\n urls: null | PlaybackUrls\n}\n\n/** Result of `syncPending()` / `POST /sync-pending`. */\nexport type SyncPendingResult = {\n /** Documents that were checked against their provider. */\n checked: number\n /** Documents whose refresh failed (logged; retried on the next run). */\n failed: number\n /** Documents whose asset no longer exists at the provider (marked as `error`). */\n missing: number\n}\n\n/** Result of `adoptExisting()`. */\nexport type AdoptExistingResult = {\n /** Documents created for assets that weren't tracked yet. */\n created: number\n /** Assets that already had a document. */\n skipped: number\n}\n\n/** Result of `createUpload()` / `POST /upload`. */\nexport type CreateUploadResult = {\n /** The provider's asset id, when it exists already (not for Mux until the upload completes). */\n assetId?: string\n /** Payload document id. */\n id: number | string\n provider: string\n /** Where and how the browser sends the file. */\n upload: DirectUpload\n}\n"],"names":[],"mappings":"AAmPA,iDAAiD,GACjD,WAQC"}
1
+ {"version":3,"sources":["../src/types.ts"],"sourcesContent":["import type { VideoBlockArgs } from './blocks.js'\nimport type { CollectionConfig, PayloadRequest, TaskConfig } from 'payload'\n\nimport type { DirectUpload, PlaybackUrls, VideoProvider, WebhookSetup } from './core/provider.js'\nimport type { VideoStatus } from './core/status.js'\n\n/** The shape of a video document stored by the plugin. */\nexport type VideoDoc = {\n allowedOrigins?: null | string[]\n /** Provider id and asset id joined (`cloudflare:abc…`); unique, maintained by the plugin. */\n assetKey?: null | string\n /** The provider's asset id (Cloudflare uid, Mux asset id, Bunny guid). */\n assetId?: null | string\n captions?: null | {\n generated?: boolean | null\n id?: null | string\n label?: null | string\n language: string\n status?: null | string\n }[]\n createdAt?: string\n creator?: null | string\n downloads?: null | {\n audio?: null | string\n audioPercent?: null | number\n mp4?: null | string\n mp4Percent?: null | number\n }\n duration?: null | number\n error?: null | { code?: null | string; message?: null | string }\n height?: null | number\n id: number | string\n lastSyncedAt?: null | string\n meta?: null | Record<string, unknown>\n /** Review state, when `moderation` is on. */\n moderation?: null | VideoModerationStatus\n /** The user who uploaded the video, when `ownership` is on (an id, or the user when populated). */\n owner?: null | number | string | { id: number | string }\n /** Virtual: playback URLs, populated on read. */\n playback?: null | VideoPlayback\n /** Playback id, for providers that separate it from the asset id (Mux). */\n playbackId?: null | string\n /** Encoding progress 0–100, when the provider reports it. */\n progress?: null | number\n /** Id of the provider that stores the video, e.g. `cloudflare`. */\n provider?: null | string\n /** The provider's raw payload from the last sync (hidden). */\n providerData?: null | Record<string, unknown>\n readyAt?: null | string\n readyToStream?: boolean | null\n /** Previous asset, kept until a replacement upload is ready. */\n replacedAssetId?: null | string\n /** Playback requires a signed token. */\n signedPlayback?: boolean | null\n size?: null | number\n status?: null | VideoStatus\n /** Poster frame position in seconds. */\n thumbnailTime?: null | number\n title?: null | string\n updatedAt?: string\n uploadedAt?: null | string\n /** Pending upload id, for providers that create the asset in a second step (Mux). */\n uploadId?: null | string\n width?: null | number\n}\n\nexport type VideoAccessArgs = {\n /** The video document, when the operation targets an existing video. */\n doc?: VideoDoc\n req: PayloadRequest\n}\n\n/** Extra access check layered on top of the collection's own access control. */\nexport type VideoAccess = (args: VideoAccessArgs) => boolean | Promise<boolean>\n\nexport type VideoModerationStatus = 'approved' | 'pending' | 'rejected'\n\n/** Arguments of the lifecycle hooks (`hooks` option). */\nexport type VideoStatusChangeArgs = {\n doc: VideoDoc\n /** The document before the change; undefined when it was just created. */\n previousDoc?: VideoDoc\n /** null when the document was just created. */\n previousStatus: null | VideoStatus\n req: PayloadRequest\n status: VideoStatus\n}\n\nexport type VideoLifecycleHook = (args: VideoStatusChangeArgs) => Promise<void> | void\n\n/** What `upload.validate` is asked about. Exactly one of `size` (browser upload) or `url` (import) is set. */\nexport type VideoUploadCheck = {\n /** The document being replaced, if any. */\n doc?: VideoDoc\n filename?: string\n provider: string\n req: PayloadRequest\n size?: number\n /** MIME type reported by the browser, when known. */\n type?: string\n url?: string\n}\n\n/** The settings of `ownership`, resolved. */\nexport type ResolvedOwnership = {\n /** Who may change a video's owner. Server code without a user always may. */\n canAssign: (args: { req: PayloadRequest }) => boolean | Promise<boolean>\n field: string\n /** The auth collection owners belong to. */\n relationTo: string\n}\n\n/** The settings of `moderation`, resolved. */\nexport type ResolvedModeration = {\n /** Who may approve or reject videos. Server code without a user always may. */\n canModerate: (args: { req: PayloadRequest }) => boolean | Promise<boolean>\n /** The status of a new video. */\n defaultStatus: (args: { canModerate: boolean; req: PayloadRequest }) => Promise<VideoModerationStatus> | VideoModerationStatus\n field: string\n}\n\nexport type VideoPluginOptions = {\n /**\n * Extra access checks. Collection access (read/create/update/delete) is always enforced first;\n * these let you restrict plugin-specific actions further.\n */\n access?: {\n /** Manage captions / downloads / sync. Default: collection `update` access. */\n manage?: VideoAccess\n /**\n * Who may receive playback URLs (including signed tokens) via the playback endpoint.\n * Default: anyone with collection `read` access to the video.\n */\n playback?: VideoAccess\n /** Create uploads / imports. Default: collection `create` access (or `update` when replacing). */\n upload?: VideoAccess\n }\n /** Collection customisation. */\n collection?: {\n /**\n * Access control for the videos collection, passed straight to Payload. Unset operations use\n * Payload's defaults (logged-in users only). For example, to show videos to visitors of a public\n * site: `{ read: () => true }`. Private videos stay protected by `signedPlayback` and\n * `access.playback`.\n */\n access?: CollectionConfig['access']\n /** Admin group label. Default: none. */\n adminGroup?: string\n /** Last chance to modify the generated collection config. */\n override?: (collection: CollectionConfig) => CollectionConfig\n /** Default: `videos` */\n slug?: string\n }\n /** Provider for new uploads when several are configured. Default: the first one. */\n defaultProvider?: string\n /**\n * Lifecycle hooks, called after a video's `status` changes, whatever changed it (a webhook, a sync,\n * the sync-pending task or a new upload). They run after the change is saved, inside the same\n * request, so keep them quick or queue a job. Errors are logged and never undo the change.\n */\n hooks?: {\n /** Every status change, including the first status of a new video (`previousStatus: null`). */\n afterStatusChange?: VideoLifecycleHook\n /** The video failed to upload or process (`status: 'error'`, details in `doc.error`). */\n onError?: VideoLifecycleHook\n /** The video can be played (`status: 'ready'`). */\n onReady?: VideoLifecycleHook\n }\n /**\n * Review new videos before they're shown: adds a `moderation` field (`pending`, `approved`,\n * `rejected`). It only records the decision: pair it with read access such as\n * `approvedOrOwner()` to hide unapproved videos. `true` uses the defaults below.\n */\n moderation?:\n | boolean\n | {\n /** Who may approve or reject. Default: users of the admin user collection (`admin.user`). */\n canModerate?: ResolvedModeration['canModerate']\n /** Status of new videos. Default: `approved` when the uploader may moderate, otherwise `pending`. */\n defaultStatus?: ResolvedModeration['defaultStatus']\n /** Field name. Default `moderation`. */\n field?: string\n }\n /**\n * Record who uploaded each video: adds an `owner` relationship, set from the logged-in user when a\n * video is created and protected from changes by other users. It doesn't restrict anything by\n * itself: use it in access control, e.g. `ownerOr(isAdmin)` from this package. `true` uses the\n * defaults below.\n */\n ownership?:\n | boolean\n | {\n /** Who may change a video's owner. Default: nobody (server code without a user always may). */\n canAssign?: ResolvedOwnership['canAssign']\n /** Field name. Default `owner`. */\n field?: string\n /** The auth collection of the uploaders. Default: the admin user collection (`admin.user`). */\n relationTo?: string\n }\n /** Delete the provider's asset when its document is deleted. Default: true. */\n deleteFromProvider?: boolean\n /**\n * Keeps the collection (so your schema/migrations stay stable) but disables endpoints, hooks\n * and admin components. `providers` may be empty.\n */\n disabled?: boolean\n /** Playback URL generation. */\n playback?: {\n /**\n * Extend signed tokens so they outlast the video: a video of `duration` seconds gets at least\n * `duration × factor + marginSeconds` (still capped at the provider's maximum), so a token never\n * expires while someone is watching. An explicit `expiresIn` passed to `getPlayback()` or the\n * playback endpoint takes precedence. Default `{ factor: 2, marginSeconds: 600 }`; `false` always\n * uses `expiresIn`.\n */\n coverDuration?: { factor?: number; marginSeconds?: number } | boolean\n /** Default signed token lifetime in seconds. Default 3600 (Cloudflare's maximum is 86400). */\n expiresIn?: number\n /**\n * Populate a virtual `playback` field on every read (REST, GraphQL, Local API).\n * Signed videos get a fresh token when the reader passes `access.playback`.\n * Default: true.\n */\n populateOnRead?: boolean\n /**\n * Visitors can watch the videos embedded in documents they can read (`videoField()`, video blocks,\n * rich text), even when they can't read the videos collection itself. Restricted videos are\n * excluded: signed playback, unapproved ones (with `moderation`), and those `access.playback`\n * denies. Video documents still can't be listed or fetched by id without read access.\n * Default true; `false` makes playback follow the videos collection's read access only.\n */\n embedded?: boolean\n }\n /** The video providers, e.g. `[cloudflareStream({ … })]`. Required unless `disabled`. */\n providers: VideoProvider[]\n /**\n * Registers a Payload jobs task that refreshes videos that are still processing. Use it when webhooks\n * aren't configured (or as a safety net), so documents reach `ready`/`error` even if nobody has the\n * admin open. Queue it yourself, or pass `cron` (or `schedule`) to run it automatically.\n */\n syncPendingTask?:\n | boolean\n | {\n /**\n * When `cron` is set, also add a `jobs.autoRun` entry for `queue` so the task runs without any\n * other configuration. Set to `false` if you run jobs yourself (e.g. a worker or `/api/payload-jobs/run`).\n * Default `true`.\n */\n autoRun?: boolean\n /** Max documents refreshed per run. Default 50. */\n batchSize?: number\n /**\n * How often to sync, as a cron expression: 5 fields, or 6 with seconds. For example\n * `'* * * * *'` (every minute) or `'*\\/5 * * * *'` (every 5 minutes). Env: `VIDEO_SYNC_CRON`.\n */\n cron?: string\n /** Jobs queue the task is scheduled on. Default `videos`. */\n queue?: string\n /** Full Payload jobs schedule. Takes precedence over `cron`/`queue`. */\n schedule?: TaskConfig['schedule']\n /** Task slug. Default `videoSyncPending`. */\n slug?: string\n }\n /** Defaults for new videos, for every provider. */\n upload?: {\n /**\n * File types browsers may upload through `POST /upload`: MIME types (`video/mp4`), wildcards\n * (`video/*`) or extensions (`.mp4`). Checked against the file name and the type the browser\n * reports. Default: any type (the provider rejects files it can't process).\n */\n allowedTypes?: string[]\n /** `creator` value stored on the video. Default: the uploading user's id. */\n creator?: (req: PayloadRequest) => string | undefined\n /**\n * Longest video, in seconds, for providers that enforce it at upload (Cloudflare). A request can\n * lower it but not raise it.\n */\n maxDurationSeconds?: number\n /** Largest file, in bytes, that browsers may upload through `POST /upload`. Default: no limit. */\n maxFileSize?: number\n /** New videos require signed playback URLs. Default false. */\n signedPlayback?: boolean\n /** Default poster frame position, in seconds. */\n thumbnailTime?: number\n /**\n * Your own check before every `POST /upload` and `POST /import`, e.g. a per-user quota. Return\n * `true` to allow it, or a message to refuse it (sent to the browser with status 400).\n */\n validate?: (args: VideoUploadCheck) => Promise<string | true> | string | true\n }\n /**\n * Register the video block in `config.blocks`, so blocks fields and Lexical can reference it by\n * slug (`videoBlockReferences('video')`, `BlocksFeature({ blocks: ['video'] })`).\n * Not needed when you use `videoBlock()` inline. Default false.\n */\n videoBlock?: boolean | Omit<VideoBlockArgs, 'collectionSlug'>\n}\n\nexport type ResolvedVideoOptions = {\n access: NonNullable<VideoPluginOptions['access']>\n collection: VideoPluginOptions['collection']\n collectionSlug: string\n defaultProvider?: string\n deleteFromProvider: boolean\n hooks: NonNullable<VideoPluginOptions['hooks']>\n moderation?: ResolvedModeration\n ownership?: ResolvedOwnership\n playback: {\n coverDuration: { factor: number; marginSeconds: number } | false\n expiresIn: number\n /** Longest token lifetime every configured provider accepts. */\n maxTokenTtlSeconds: number\n embedded: boolean\n populateOnRead: boolean\n }\n providers: VideoProvider[]\n syncPendingTask?: {\n autoRun: boolean\n batchSize: number\n cron?: string\n queue: string\n schedule?: TaskConfig['schedule']\n slug: string\n }\n upload: {\n allowedTypes?: string[]\n creator?: (req: PayloadRequest) => string | undefined\n maxDurationSeconds?: number\n maxFileSize?: number\n signedPlayback: boolean\n thumbnailTime?: number\n validate?: NonNullable<VideoPluginOptions['upload']>['validate']\n }\n}\n\n/** Result of the playback endpoint / server API, and the virtual `playback` field. */\nexport type VideoPlayback = {\n assetId: string\n /** ISO timestamp when the signed token expires. */\n expiresAt?: string\n playbackId?: string\n provider: string\n readyToStream: boolean\n /** True when the URLs below contain a signed token. */\n signed: boolean\n /** True when the video requires signed playback URLs. */\n signedPlayback: boolean\n status: null | VideoStatus\n token?: string\n /** null when the video requires signed URLs but the reader may not receive a token. */\n urls: null | PlaybackUrls\n}\n\n/** Result of `syncPending()` / `POST /sync-pending`. */\nexport type SyncPendingResult = {\n /** Documents that were checked against their provider. */\n checked: number\n /** Documents whose refresh failed (logged; retried on the next run). */\n failed: number\n /** Documents whose asset no longer exists at the provider (marked as `error`). */\n missing: number\n}\n\n/** Result of `adoptExisting()`. */\nexport type AdoptExistingResult = {\n /** Documents created for assets that weren't tracked yet. */\n created: number\n /** Assets that already had a document. */\n skipped: number\n}\n\n/** Result of `createUpload()` / `POST /upload`. */\nexport type CreateUploadResult = {\n /** The provider's asset id, when it exists already (not for Mux until the upload completes). */\n assetId?: string\n /** Payload document id. */\n id: number | string\n provider: string\n /** Where and how the browser sends the file. */\n upload: DirectUpload\n}\n\n/** The latest webhook delivery and rejection a server saw for a provider. */\nexport type WebhookHealth = {\n /** The last accepted delivery; `matched` is false when it was about a video this site doesn't track. */\n lastDelivery?: { at: string; matched: boolean }\n /** The last refused delivery (bad signature, stale or malformed). */\n lastRejection?: { at: string; reason: string; status: number }\n}\n\n/** Result of `webhookStatus()` / `GET /webhooks`, one entry per provider. */\nexport type WebhookStatus = {\n /** A webhook secret is set, so deliveries are verified and applied. */\n configured: boolean\n label: string\n provider: string\n /** How to register the URL and where the secret comes from. */\n setup?: WebhookSetup\n /** The provider can send webhooks. */\n supported: boolean\n /** The endpoint to register with the provider (absolute when `serverURL` is set). */\n url: string\n} & WebhookHealth\n"],"names":[],"mappings":"AAsYA,2EAA2E,GAC3E,WAWiB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "payload-video-streaming",
3
- "version": "0.2.0-beta.0",
3
+ "version": "0.2.0-beta.1",
4
4
  "description": "Video streaming for Payload CMS (v3 and v4) with Cloudflare Stream, Mux and Bunny Stream: direct uploads, signed playback, webhooks, captions, blocks and bring-your-own player.",
5
5
  "keywords": [
6
6
  "payload",
@@ -144,6 +144,7 @@
144
144
  "next": "16.4.6",
145
145
  "openapi-typescript": "7",
146
146
  "payload": "4.0.0-beta.12",
147
+ "player.js": "0.1.0",
147
148
  "portless": "0.18.1",
148
149
  "react": "19.3.1",
149
150
  "react-dom": "19.3.1",