Build your first flow in MediaFlows
Last updated: Dec-15-2022
Once you have signed up to MediaFlows and created a project you can proceed to create your first flow.
Video walkthrough
This video walks you through creating a flow that runs automatically when a video is uploaded to Cloudinary using a specific upload preset. A square thumbnail of the video is uploaded to a folder called video_thumbnails in your Media Library.
Follow the steps in this video to create the flow:
To create this flow:
1. In your project click Create New Flow. | |
2. Select Start from scratch to open a blank canvas. | |
3. Rename the flow from New Flow to Video Thumbnails in the top left of the canvas. | |
4. From the Media Blocks panel on the left, select and drag a Catch Webhook block onto the canvas. | |
5. Double-click the Catch Webhook block, then click Create Upload Preset. If you go to your Cloudinary Console, navigate to Settings > Upload and scroll down to Upload presets you'll see a new upload preset where Notification URL is set to the webhook URL in the block. ![]() Whenever an upload to your Cloudinary product environment is made using this upload preset, a notification will be sent to this URL, which will trigger the flow. |
|
6. Click Save to close the block. | |
7. From the Media Blocks panel, select and drag a Resize Video block onto the canvas, to the right of the Catch Webhook block. | |
8. Join the two blocks together by selecting the blue output of the Catch Webhook block and dragging it to the input of the Resize Video block. | |
9. Double-click the Resize Video block, enter 200 in the Width and Height fields, and clear the Aspect Ratio field. Leave the Crop field as Fill and the Gravity field as Automatic - these settings ensure the most interesting parts of the video are kept in the crop. This block does not resize the newly uploaded video, but it creates an eager transformation of the video. | |
10. Click Save to close the block. | |
11. From the Media Blocks panel, select and drag an Upload Media block onto the canvas, to the right of the Resize Video block. | |
12. Join the two blocks together by selecting the blue output of the Resize Video block and dragging it to the input of the Upload Media block. | |
13. At this stage you need to push media into the flow, to populate the dynamic values in the Upload Media block. Do this by uploading a video to your Cloudinary product environment, using the upload preset that was created, MediaFlows_Video Thumbnails_Catch Webhook. In the video this is done using the Upload Widget in the Media Library, but not all product environments have the option to select the upload preset from here, so if you don't, you could, for example, use the Cloudinary CLI: |
cld uploader upload video.mp4 upload_preset="MediaFlows_Video Thumbnails_Catch Webhook"
14. Double-click the Upload Media block to edit the settings. | |
15. At the bottom of the block select the curly braces icon { } (dynamic value selection). From the drop down, select [Resize Video].eager[0].secure_url . If this option is not there, you may need to wait a few moments. Paste the copied value into the Media URL field. This provides the URL of the eager transformation performed on the video in the Resize Video block. |
|
16. Select Video for the Asset Type. | |
17. Set the Optional Parameters to: |
18. Click Save to close the block. This block is now set to upload the resized video into the video_thumbnails folder. |
And that's it! You can now test your flow by uploading a video to your Cloudinary product environment, using your upload preset.
For example, using the Cloudinary CLI:
cld uploader upload video.mp4 upload_preset="MediaFlows_Video Thumbnails_Catch Webhook"
In your Media Library, you'll see the original uploaded video in the root of your library, and the 200x200 pixel video thumbnail of the video in the video_thumbnails folder.