- How do I integrate Darkwood Media Bundle into a Laravel app for video generation?
- Install via Composer (`composer require darkwood/media-bundle`), then invoke the Symfony CLI through Artisan. For synchronous use, run `php artisan app:video:generate path/to/script.yaml`. For async processing, dispatch a Laravel job (e.g., `GenerateVideoJob`) with the `--async` flag in the command.
- Does Darkwood Media Bundle support Laravel’s queue system for background video generation?
- Yes, the package now includes a `TrueAsyncDriver` (Symfony v8.1.1+) for non-blocking video generation. Dispatch a job like `GenerateVideoJob::dispatch($yamlPath)->onQueue('videos')` to offload processing. Use Laravel’s job lifecycle (status fields, retries) to track progress and handle failures.
- What Laravel versions are compatible with Darkwood Media Bundle?
- The bundle is designed for Laravel 10.x+ due to Symfony v8.1.1 dependencies. Test thoroughly with your Laravel version, as Symfony component conflicts (e.g., `symfony/process`) may arise. Pin the bundle’s Composer version to `8.1.1` to mitigate risks, and use `composer why-not` to check for conflicts.
- How do I configure Replicate API access for voice/video synthesis in Laravel?
- Set environment variables for Replicate credentials (e.g., `REPLICATE_API_TOKEN`) as documented in `docs/mvp-video.md`. The bundle uses these to authenticate API calls during asset generation. Ensure your Laravel `.env` mirrors these variables, and test with mocked HTTP calls (`make phpunit`) before production.
- Where are intermediate video assets stored during async generation, and how do I clean them up?
- Intermediate assets (e.g., voice files, renders) default to `/tmp/` but can be configured to use Laravel’s storage (e.g., `storage_path('app/temp/')`). Implement a job failure handler to delete partial assets. Use Laravel’s `Storage::delete()` or Symfony’s `Filesystem` component to clean up after job completion or failure.
- Can I test Darkwood Media Bundle locally without hitting Replicate API limits?
- Yes, the bundle includes mocked HTTP tests for Replicate providers. Run `make phpunit` or `./bin/phpunit` to execute tests without live API calls. For integration tests, use Laravel’s `Queue::fake()` to simulate async job execution and verify asset generation workflows.
- What happens if an async video job fails mid-generation in Laravel?
- Failed async jobs leave intermediate files unless cleaned up. Configure a job failure callback in Laravel to delete partial assets (e.g., via `handleFailure()`). Use `Process::terminate()` to kill lingering processes, and log errors to debug YAML schema or API issues.
- Is there a way to benchmark video generation performance before production?
- Yes, the bundle supports benchmark mode via CLI flags (documented in `docs/mvp-video.md`). Run `php bin/console app:video:generate --benchmark script.yaml` to measure scene processing times. Use this to optimize YAML scripts or adjust Laravel queue worker settings (e.g., `maxJobs`).
- How do I handle YAML schema changes in Laravel without breaking existing video templates?
- Version your YAML scripts (e.g., `welcome_v1.yaml`, `welcome_v2.yaml`) and document breaking changes in your Laravel app’s README. Use Laravel’s config system to map schema versions to generator settings, and validate scripts with a custom `YamlValidator` service before processing.
- Are there alternatives to Darkwood Media Bundle for Laravel video generation?
- Alternatives include Laravel-specific packages like `spatie/laravel-video` (for video uploads) or general-purpose tools like FFmpeg (for manual processing). However, Darkwood’s YAML-driven workflow and Replicate integration are unique for dynamic, personalized video generation. Evaluate based on your need for async support, voice synthesis, and manifest output.