Skip to content

fix: support f_auto extensionless raw URLs#1048

Merged
tsi merged 1 commit into
masterfrom
VIDEO-19609-f_auto-urls
May 13, 2026
Merged

fix: support f_auto extensionless raw URLs#1048
tsi merged 1 commit into
masterfrom
VIDEO-19609-f_auto-urls

Conversation

@tsi
Copy link
Copy Markdown
Collaborator

@tsi tsi commented May 13, 2026

Summary

Raw URLs without a file extension (e.g. Cloudinary f_auto delivery URLs like https://res.cloudinary.com/.../cld-sample-video) could not be played because generateRawSource was falling back to url.split('.').pop(), which returns a bogus "extension" (the full last URL path segment), producing an invalid MIME type like video/com/.../cld-sample-video.

The fix routes extensionless raw URLs through the existing video/auto middleware, which issues a HEAD request to resolve the real Content-Type from the server.

Changes

  • generateRawSource now checks the URL's last segment against COMMON_VIDEO_EXTENSIONS
    • Known extension (e.g. .mp4, .m3u8) - used directly as before
    • Unknown/no extension - falls back to 'auto' - video/auto MIME type, triggering the HEAD middleware
  • Explicit sourceTypes (non-auto) are still respected and passed through unchanged
  • COMMON_VIDEO_EXTENSIONS exported from video-source.const.js to enable the check
  • generateSources simplified: no longer converts 'auto' to null before passing to generateRawSource

How to Test

Load the player with an extensionless f_auto Cloudinary URL:

player.source('https://res.cloudinary.com/<cloud>/video/upload/c_scale,h_720,w_640/samples/cld-sample-video');

Expected: video plays normally (middleware resolves video/mp4 via HEAD request).

Also verify a raw URL with a known extension still works:

player.source('https://example.com/video.mp4');

Expected: plays as video/mp4 directly, no HEAD request needed.

@tsi tsi requested a review from a team as a code owner May 13, 2026 10:37
@netlify
Copy link
Copy Markdown

netlify Bot commented May 13, 2026

Deploy Preview for cld-video-player ready!

Name Link
🔨 Latest commit cfdf763
🔍 Latest deploy log https://app.netlify.com/projects/cld-video-player/deploys/6a04547dc69356000981a4b1
😎 Deploy Preview https://deploy-preview-1048--cld-video-player.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify
Copy link
Copy Markdown

netlify Bot commented May 13, 2026

Deploy Preview for cld-vp-esm-pages ready!

Name Link
🔨 Latest commit cfdf763
🔍 Latest deploy log https://app.netlify.com/projects/cld-vp-esm-pages/deploys/6a04547dacc47800081321c4
😎 Deploy Preview https://deploy-preview-1048--cld-vp-esm-pages.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@tsi tsi merged commit 9e6485a into master May 13, 2026
10 checks passed
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.

2 participants