Webhooks for status
Webhooks are a mechanism for communication between two web applications in real-time.
FastPix uses webhooks to tell your application about things that happen in the background, outside of the API regular request flow. These events could involve media creation, update, or deleting. For instance, if an asset goes from being processed to ready, or if a live stream starts or stops, we'll shoot a POST message to the provided address when these events occur. Once you set up a webhook for a specific workspace, it will send notifications for all events in that workspace.
Requirements for webhooks implementation
Create a webhooks endpoint:
You need to create a designated endpoint on your server to receive incoming webhook requests from FastPix. This endpoint, usually an URL, will serve as the destination for data sent via the POST method when specific trigger events related to on-demand video and livestreaming occur within your application.
Identify the trigger event:
Determine the event or action in your application that should trigger the webhook. For instance, it could be a new user signup, a file uploaded, start of a livestream or any viewer interactions.
Configure webhooks in FastPix
Head to your FastPix dashboard and navigate to "Org Settings" to set up webhooks.
Once you click Create new webhook, you can choose the workspace you want notifications for in FastPix. Also, enter an URL from your application that FastPix will notify for event notifications. Click the "Create new webhook" button to start receiving notifications.
You can get a webhook proxy unique URL from webhook.site and create a webhook API for a particular workspace. For now, copy the generated unique URL and place it under “Enter URL to notify” on the FastPix dashboard as displayed above.
USING Webhook.site
Webhook.site is a tool for building software that not only use webhooks but other types of communication, either by allowing developers to inspect the data that's being sent via a webhook, but also helps users create workflows that respond to and interact with webhooks from various systems.
When visiting Webhook.site, users instantly get a free, unique, random URL and e-mail address. Everything that's sent to these addresses are shown instantly. With this, users can test and debug Webhooks and HTTP requests, as well as create workflows using the Custom Actions graphical builder or WebhookScript, a simple scripting language, to transform, validate and process HTTP requests in a variety of ways – without setting up and maintaining your own infrastructure.
Once webhook is created, you'll see the new webhook listed in your FastPix dashboard for the chosen workspace, along with its corresponding URL
Receiving events
You can test the webhook you just created to ensure it receives events for your website URL. For this, try sending a test event like pull or push video from FastPix to verify it reaches your specified URL.
FastPix will shoot over a message to the URL you provided using a POST request, and your app can handle it just like any other route. Your event handler gets to decide what happens next – like updating the status of a specific asset in your database or kicking off other tasks.
Here is how the webhook event (response) looks like on webhooks.site:
Capturing all events and log activities
To see all events related activity for any media, click on any media listed out under media dashboard – this opens up the media details page. Next, you can view the event and logs under the API activity section.
To further deep dive and get additional information about events, click on any event such as video.media.ready which would open up the event detail page
Apart from events, FastPix also provides webhook logs which shows every API action taken in the last 30 days. This helps you to check if FastPix received your request correctly, especially when a media fails.
List of all webhook events
Media related events
These events notify your system about the creation, availability, or failure of media assets, such as videos or audio files. They also track when media assets are updated or deleted, allowing your system to respond accordingly.
video.media.created
: This event is triggered when a new media has been successfully created. Use this to notify your system when media is available in the platform.video.media.ready
: The media (video or audio) is ready for playback. At this point, you can use the playbackId to initiate the streaming of this media successfully.video.media.failed
: The media asset has encountered an error during processing. Common causes include issues with the input URL (e.g., inaccessible or invalid video files). This event notifies your system about media errors for troubleshooting.video.media.delete
: This event is fired when a media has been deleted. This informs your system to remove any references to the media, as it will no longer be available for playback.video.media.updated
: This event is triggered when any updates are made to an existing media, allowing your system to respond to changes.
Upload related events
These events provide updates on the media upload process, from the initiation of direct uploads to the point where the media is ready for playback. They also capture any errors that occur during uploads, ensuring your system can manage failed attempts.
video.upload.media_created
: A media asset has been created from an upload. This is triggered when an end user finishes uploading a file through a direct upload URL.video.upload.created
: This event indicates that a direct upload has been initiated. It’s useful for tracking when users of your application start the media upload process.video.upload.ready
: The uploaded media is ready for playback. You can now use the playbackId to stream the media successfully.video.upload.failed
: The upload has failed. This event is triggered when an uploaded file cannot be processed into media, typically due to invalid input.Video.media.live_stream.created
: This event is triggered when a live streaming gets recorded into an on-demand media. The system stores the live stream and creates a manifest file, which is used to generate the playbackId for streaming.
Live stream related events
These events track the full lifecycle of live streams, including creation, connection, and when the stream goes live or becomes idle. Additionally, they monitor the recording process and provide updates when streams are updated, enabled, disabled, or deleted.
video.live_stream.created
: A new live stream has been created. Broadcasters possessing a stream key can commence transmitting their encoder feed to this particular live stream.video.live_stream.connected
: The live stream is in a "connected" status for video live streaming, confirming that an encoder has established a successful connection to it.video.live_stream.recording
: The live stream's video recording is now in progress.video.live_stream.active
: The live stream is currently marked as "active," signifying that it is presently "live" and actively broadcasting.video.live_stream.disconnected
: When the stream is stopped, causing the encoder to become disconnected.video.live_stream.idle
: The live stream enters an "idle" state as there is no ongoing streaming activity.video.asset.created
: The live stream enters an "idle" state as there is no ongoing streaming activity.video.live_stream.updated
: The live stream has been either updated, or the stream key for this livestream has been reset.video.live_stream.enabled
: The live stream that was previously disabled has now been enabled.video.live_stream.disabled
: The live stream has been disabled, and if desired, it can be re-enabled. However, please note that test streams cannot be re-enabled.video.live_stream.deleted
: The live stream has been deleted.
Simulcast target events
Simulcast target events give real-time updates on the status of third-party endpoints used in live streaming. They help you track the creation and deletion of simulcast targets, allowing your system to reflect their current status accurately in the user interface.
video.live_stream.simulcast.created
: A new simulcast has been created for a live stream.video.live_stream.simulcast.deleted
: When the simulcast of a live stream has been deleted.
Updated 16 days ago