Skip to content

feat: add Laravel Event System integration for media processing #540

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

marcialpaulg
Copy link
Contributor

@marcialpaulg marcialpaulg commented Aug 3, 2025

Summary

This PR adds comprehensive Laravel Event System integration to the FFmpeg package, enabling developers to build reactive workflows and real-time progress monitoring.

New Features

  • Laravel Events Integration: Four new events fired during media processing lifecycle

    • MediaProcessingStarted - When encoding begins
    • MediaProcessingProgress - Real-time progress updates during encoding
    • MediaProcessingCompleted - When encoding completes successfully
    • MediaProcessingFailed - When encoding encounters errors
  • Configuration Control: New enable_events config option (defaults to true)

  • FFmpeg 7.x Compatibility: Updated test patterns to support FFmpeg 7.x while maintaining 4.4/5.0 compatibility

  • HLS Event Support: Events work seamlessly with HLS streaming exports

Event Properties

Each event includes:

  • Input media collection
  • Output path (when available)
  • Processing metadata
  • Progress events include percentage, remaining time, and processing rate

Use Cases

  • Real-time Progress: WebSocket broadcasting for live progress updates
  • Workflow Automation: Trigger notifications, database updates, thumbnails generation
  • Error Handling: Custom error handling and retry logic
  • Analytics: Track processing metrics and performance

Documentation

  • Comprehensive README documentation with examples
  • Event listener creation examples
  • Configuration options
  • Real-world usage patterns

Test Plan

  • All existing tests pass
  • New event system tests added and passing
  • FFmpeg 4.4, 5.0, and 7.x compatibility verified
  • HLS exports work with events
  • Event configuration tested
  • Documentation examples verified

Breaking Changes

None - this is a purely additive feature that maintains full backward compatibility.

Deprecated: Creation of dynamic property DynamicHLSPlaylist::$playlistResolver is deprecated in file on line 94
- Add MediaProcessingStarted, MediaProcessingProgress, MediaProcessingCompleted, and MediaProcessingFailed events
- Events fire automatically during all media processing operations including HLS exports
- Add enable_events configuration option (defaults to true)
- Events include input media collection, output path, and processing metadata
- Progress events include real-time percentage, remaining time, and processing rate
- Update README with comprehensive event system documentation
- Add FFmpeg 7.x compatibility while maintaining support for 4.4 and 5.0
- Fix HLS test patterns to handle AVERAGE-BANDWIDTH field in newer FFmpeg versions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant