{"id":42642696,"url":"https://github.com/webowodev/payload-video-stream","last_synced_at":"2026-02-11T13:03:24.956Z","repository":{"id":324639707,"uuid":"1097556548","full_name":"webowodev/payload-video-stream","owner":"webowodev","description":"Payload CMS plugin for streaming video uploads to cloud providers like Cloudflare Stream","archived":false,"fork":false,"pushed_at":"2026-01-29T11:57:09.000Z","size":257,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-29T21:24:41.226Z","etag":null,"topics":["cloudflare-stream","cms-plugin","payload","payload-cms","payload-plugin","r2-storage","s3-storage","video-processing","video-streaming","video-upload"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/webowodev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-11-16T12:11:48.000Z","updated_at":"2026-01-29T11:57:11.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/webowodev/payload-video-stream","commit_stats":null,"previous_names":["webowodev/payload-video-stream"],"tags_count":21,"template":false,"template_full_name":null,"purl":"pkg:github/webowodev/payload-video-stream","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webowodev%2Fpayload-video-stream","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webowodev%2Fpayload-video-stream/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webowodev%2Fpayload-video-stream/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webowodev%2Fpayload-video-stream/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/webowodev","download_url":"https://codeload.github.com/webowodev/payload-video-stream/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webowodev%2Fpayload-video-stream/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29333155,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-11T12:42:24.625Z","status":"ssl_error","status_checked_at":"2026-02-11T12:41:23.344Z","response_time":97,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cloudflare-stream","cms-plugin","payload","payload-cms","payload-plugin","r2-storage","s3-storage","video-processing","video-streaming","video-upload"],"created_at":"2026-01-29T06:27:44.599Z","updated_at":"2026-02-11T13:03:24.944Z","avatar_url":"https://github.com/webowodev.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Payload Video Streaming Plugin\n\nA [Payload CMS](https://payloadcms.com) plugin that enables seamless video uploads directly to streaming providers from Payload upload collections. This plugin automatically handles video file uploads to streaming platforms, providing optimized video delivery for your Payload CMS applications.\n\n## Features\n\n- 🎥 Direct video uploads to streaming providers from Payload upload collections\n- ☁️ **Cloudflare Stream** support (currently available)\n- 🔌 Extensible adapter architecture for adding more streaming providers\n- 🔄 Automatic video processing and optimization\n- 📊 Stream metadata integration with Payload documents\n- 🎯 Type-safe configuration with TypeScript support\n\n## Supported Providers\n\nCurrently supported:\n- **Cloudflare Stream** - Complete integration with Cloudflare's video streaming platform\n\nPlanned support:\n- Mux\n- AWS MediaConvert\n- Azure Media Services\n- Other streaming API providers\n\n## Installation\n\n```bash\nnpm install payload-video-stream\n# or\nyarn add payload-video-stream\n# or\npnpm add payload-video-stream\n```\n\n## Quick Start\n\n### 1. Configure the Plugin\n\nAdd the plugin to your `payload.config.ts`:\n\n```ts\nimport { buildConfig } from 'payload/config'\nimport { videoStream } from 'payload-video-stream'\nimport { cloudflareStreamAdapter } from 'payload-video-stream/adapters'\n\nexport default buildConfig({\n  plugins: [\n    // configure your s3 storage configuration\n    s3Storage({\n      bucket: process.env.S3_BUCKET ?? 'romonoa',\n      clientUploads: true, // enable client-side uploads\n      collections: {\n        video: true,\n      },\n      config: {\n        credentials: {\n          accessKeyId: process.env.S3_ACCESS_KEY_ID ?? '',\n          secretAccessKey: process.env.S3_SECRET_ACCESS_KEY ?? '',\n        },\n        endpoint: process.env.S3_ENDPOINT,\n        region: process.env.S3_REGION,\n        // ... Other S3 configuration\n      },\n      signedDownloads: {\n        // expires in 24 hours\n        expiresIn: 60 * 60 * 24,\n      }, // enable signed download URLs\n    }),    \n\n    // configure video stream plugin\n    videoStream({\n      collections: {\n        media: true,\n      },\n\n      // configure default adapter, currently only support cloudflare stream adapter\n      defaultAdapter: cloudflareStreamAdapter({\n        accountId: process.env.CLOUDFLARE_STREAM_ACCOUNT_ID || '',\n        apiToken: process.env.CLOUDFLARE_STREAM_API_TOKEN || '',\n        customerSubdomain: process.env.NEXT_PUBLIC_CLOUDFLARE_STREAM_CUSTOMER_SUBDOMAIN || '',\n        requireSignedURLs: true // OPTIONAL: enable this if you enabled the signed downloads on your storage so the plugin will use the signed s3 url to the cloudflare stream copy video url function\n      }),\n    }),\n  ],\n  // ... rest of your config\n})\n```\n\n### 2. Environment Variables\n\nCreate a `.env` file with your streaming provider credentials:\n\n```env\nCLOUDFLARE_STREAM_API_TOKEN=your_cloudflare_api_token\nCLOUDFLARE_STREAM_ACCOUNT_ID=your_cloudflare_account_id\nNEXT_PUBLIC_CLOUDFLARE_STREAM_CUSTOMER_SUBDOMAIN=https://customer-\u003cYOUR_CUSTOMER_ID\u003e.cloudflarestream.com\n```\n\n### 3. Create a Video Collection\n\nThe plugin works with Payload upload collections:\n\n```ts\nimport type { CollectionConfig } from 'payload/types'\n\nexport const Videos: CollectionConfig = {\n  slug: 'videos',\n  upload: {\n    mimeTypes: ['video/*'],\n  },\n  fields: [\n    {\n      name: 'title',\n      type: 'text',\n      required: true,\n    },\n    {\n      name: 'description',\n      type: 'textarea',\n    },\n  ],\n}\n```\n\n## Configuration Options\n\n### Plugin Options\n\n```ts\ntype VideoStreamConfig = {\n  collections?: {\n    [collectionSlug: string]: boolean\n  }\n  enabled?: boolean\n  defaultAdapter: StreamAdapter\n  disabled?: boolean\n  requireSignedURLs?: boolean\n}\n```\n\n### Cloudflare Stream Configuration\n\nTo use Cloudflare Stream:\n\n1. Sign up for [Cloudflare Stream](https://www.cloudflare.com/products/cloudflare-stream/)\n2. Get your Account ID from the Cloudflare dashboard\n3. Create an API token with Stream permissions\n4. Add credentials to your environment variables\n\n## Background Jobs \u0026 Status Polling\n\nThe plugin automatically manages video processing status through Payload's job queue system. When you upload a video, the plugin continuously polls the streaming provider to check when the video is ready for playback.\n\n### Automatic Task Injection\n\nThe plugin automatically injects background tasks into your Payload configuration. Each streaming adapter gets its own task that runs on the **`payloadVideoStream`** queue:\n\n- **Task Name**: `payloadStreamUpdateStatusFor{AdapterName}` (e.g., `payloadStreamUpdateStatusForCloudflareStream`)\n- **Queue Name**: `payloadVideoStream`\n- **Behavior**: Automatically registered and managed by the plugin\n\n```ts\n// The plugin injects tasks like this (happens automatically)\nconfig.jobs = {\n  ...config.jobs,\n  tasks: [\n    ...(config.jobs?.tasks || []),\n    updateStreamStatusTask(cloudflareStreamAdapter),\n  ],\n}\n```\n\n### How Status Updates Work\n\n1. **Video Upload**: When you upload a video to a collection with the plugin enabled:\n   - The video is sent to your streaming provider (e.g., Cloudflare Stream)\n   - The `stream` field is populated with metadata (`videoId`, `status: 'pending'`)\n\n2. **Background Polling**: The plugin creates a background task that:\n   - Runs periodically on the `payloadVideoStream` queue\n   - Queries the streaming provider for the current video status\n   - Updates the document in Payload with the latest status\n\n3. **Self-Requeuing**: If the video is still processing:\n   - The task automatically re-queues itself on the `payloadVideoStream` queue\n   - Retries with exponential backoff (max 3 retries)\n   - Continues until the video reaches `ready` status\n\n4. **Status Lifecycle**:\n   - `pending` → Video is being processed by the provider\n   - `ready` → Video processing complete, ready for playback\n   - `error` → Processing failed\n\n### Monitoring Status Updates\n\nYou can track video status in several ways:\n\n**In the Payload Admin UI:**\n- Go to your video collection (e.g., `/admin/collections/videos`)\n- The `stream.status` field shows the current status\n- Refresh to see the latest status from the background job\n\n**Programmatically:**\n```ts\nconst video = await payload.findByID({\n  collection: 'videos',\n  id: videoId,\n})\n\nconst streamStatus = (video.stream as { status?: string })?.status\n// 'pending', 'ready', or 'error'\n```\n\n### Queue Configuration\n\nThe `payloadVideoStream` queue is automatically created and configured. No additional setup is required. However, you can monitor queue status through:\n\n- Payload's admin UI (Jobs panel, if enabled)\n- Your job queue provider's dashboard\n- Application logs\n\n### Task Input Parameters\n\nWhen the plugin queues a status update task, it passes:\n- `documentId`: The ID of the video document to update\n- `collectionSlug`: The collection containing the video\n\nExample task payload:\n```json\n{\n  \"documentId\": \"abc123\",\n  \"collectionSlug\": \"videos\"\n}\n```\n\n## Development\n\n### Prerequisites\n\n- Node.js 18+ \n- pnpm (recommended) or npm/yarn\n- A Payload CMS project for testing\n\n### Setup\n\n1. Clone the repository:\n```bash\ngit clone https://github.com/webowodev/payload-video-stream.git\ncd payload-video-stream\n```\n\n2. Install dependencies:\n```bash\npnpm install\n```\n\n3. Set up the dev environment:\n```bash\ncd dev\ncp .env.example .env\n```\n\n4. Update the `.env` file with your configuration:\n```env\nDATABASE_URI=postgres://root:secret@127.0.0.1:5432/videostream\nPAYLOAD_SECRET=your-secret-key\nCLOUDFLARE_STREAM_API_TOKEN=your_cloudflare_api_token\nCLOUDFLARE_STREAM_ACCOUNT_ID=your_cloudflare_account_id\nNEXT_PUBLIC_CLOUDFLARE_STREAM_CUSTOMER_SUBDOMAIN=https://customer-\u003cYOUR_CUSTOMER_ID\u003e.cloudflarestream.com\n```\n\n5. Start the development server:\n```bash\npnpm dev\n```\n\nThe dev server will be available at [http://localhost:3000](http://localhost:3000)\n\n### Project Structure\n\n```\npayload-video-stream/\n├── src/\n│   ├── index.ts              # Main plugin export\n│   ├── adapters/\n│   │   ├── streamAdapter.ts  # Base adapter interface\n│   │   ├── cloudflareStream.ts # Cloudflare implementation\n│   │   └── types.ts          # Adapter type definitions\n│   ├── fields/\n│   │   └── stream.ts         # Custom field definitions\n│   └── hooks/\n│       └── afterOperation.ts # Upload hooks\n├── dev/                      # Development Payload instance\n│   ├── payload.config.ts\n│   └── app/                  # Next.js app router\n└── test-results/             # Test output\n```\n\n### Testing\n\nRun the test suite:\n\n```bash\npnpm test\n```\n\nRun tests in watch mode:\n```bash\npnpm test:watch\n```\n\nRun integration tests:\n```bash\npnpm test:int\n```\n\nRun E2E tests:\n```bash\npnpm test:e2e\n```\n\n### Building\n\nBuild the plugin for production:\n\n```bash\npnpm build\n```\n\n## Contributing\n\nWe welcome contributions! Here's how you can help:\n\n### Adding a New Streaming Provider\n\n1. Create a new adapter in `src/adapters/`:\n```ts\n// src/adapters/yourProvider.ts\nimport type { StreamAdapter } from './streamAdapter'\n\nexport class YourProviderAdapter implements StreamAdapter {\n  async upload(file: File): Promise\u003cStreamResult\u003e {\n    // Implement upload logic\n  }\n  \n  async delete(videoId: string): Promise\u003cvoid\u003e {\n    // Implement delete logic\n  }\n}\n```\n\n2. Export your adapter in `src/adapters/index.ts`\n\n3. Add configuration types in `src/adapters/types.ts`\n\n4. Write tests for your adapter\n\n5. Update documentation\n\n### Contribution Guidelines\n\n1. Fork the repository\n2. Create a feature branch: `git checkout -b feature/amazing-feature`\n3. Make your changes\n4. Add tests for new functionality\n5. Ensure all tests pass: `pnpm test`\n6. Commit your changes: `git commit -m 'Add amazing feature'`\n7. Push to the branch: `git push origin feature/amazing-feature`\n8. Open a Pull Request\n\n### Code Style\n\n- Follow the existing code style\n- Use TypeScript for all new code\n- Add JSDoc comments for public APIs\n- Run `pnpm lint` before committing\n\n### Commit Messages\n\nFollow [Conventional Commits](https://www.conventionalcommits.org/):\n\n- `feat:` New features\n- `fix:` Bug fixes\n- `docs:` Documentation changes\n- `test:` Test additions or changes\n- `refactor:` Code refactoring\n- `chore:` Maintenance tasks\n\n## Roadmap\n\n- [x] Cloudflare Stream adapter\n- [ ] Mux adapter\n- [ ] AWS MediaConvert adapter\n- [ ] Azure Media Services adapter\n- [ ] Video thumbnail generation\n- [ ] Webhook support for processing status\n- [ ] Custom video player integration\n- [ ] Analytics integration\n\n## License\n\nMIT License - see the [LICENSE](LICENSE) file for details.\n\nCopyright (c) 2025\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n## Support\n\n- 📖 [Documentation](https://github.com/webowodev/payload-video-stream#readme)\n- 🐛 [Issue Tracker](https://github.com/webowodev/payload-video-stream/issues)\n- 💬 [Discussions](https://github.com/webowodev/payload-video-stream/discussions)\n\n## Acknowledgments\n\nBuilt with [Payload CMS](https://payloadcms.com) - The most powerful TypeScript headless CMS.\n\n---\n\nMade with ❤️ by [webowodev](https://webowo.dev)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebowodev%2Fpayload-video-stream","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwebowodev%2Fpayload-video-stream","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebowodev%2Fpayload-video-stream/lists"}