Conversation
CldVideoPlayer has been pinned to cloudinary-video-player@1.11.1 (March 2024). That release's analytics plugin only checks window.ga once at setup and then calls it unguarded on every tracked event, so with `analytics: true` on a GA4/GTM page (where window.ga is truthy but not callable) the first event throws an uncaught TypeError and stalls whatever the host page chained after player init. The analytics plugin was rewritten around gtag in later majors, so the fix is to load a current player. 4.1.2 keeps dist/cld-video-player.min.js as the full sync bundle, so cloudinary.videoPlayer(), player.on() and videojs.cloudinary.dispose() all keep working unchanged. Also: - bump @cloudinary-util/url-loader to 6.3.2 (and types/util to the versions it depends on). 5.10.4 derives `aspectRatio` from width/ height, which breaks poster URLs on player v4 (cloudinary/cloudinary-video-player#1087); 6.3.2 dropped that. - drop the icon-font download from copy-assets. dist/fonts/*.svg has not existed on unpkg for any player release in years, so the build was writing 404 HTML bodies as .svg files. Icons are inlined in the CSS. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
|
@adim-blip is attempting to deploy a commit to the Cloudinary DevX Team on Vercel. A member of the Team first needs to authorize it. |
Contributor
|
Thank you so much for this contribution! The url-loader upgrade (and to a lesser extent the player library update) are potentially breaking changes. I've implemented this particular change in #665 and we are going to batch it up with a bunch of other changes which should get released in a new major version (7.0, tracked in #523) within the next couple of weeks. If you need this functionality now, it should land in the beta channel after #665 is reviewed by @PaulBoye-py sometime in the next few days. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
CldVideoPlayerloadscloudinary-video-player@1.11.1from unpkg via a hardcodedPLAYER_VERSION. That release is from March 2024; the current player is 4.1.2.Why now: 1.11.1's analytics plugin checks
window.gaonce at setup and then callswindow.ga(...)unguarded on every tracked event. On GA4 / Google Tag Manager pageswindow.gais truthy but not callable, so withanalytics: truethe firstvolumechange/playthrows an uncaughtTypeError: window.ga is not a functionand stalls whatever the host page chained afterCldVideoPlayerinit (we saw this take down an unrelated gallery widget on a customer site). The analytics plugin was rewritten aroundgtagin later majors, so the fix is to load a current player.Changes
PLAYER_VERSION→4.1.2inCldVideoPlayer.tsxandplugins/copy-assets.ts.@cloudinary-util/url-loader5.10.4 → 6.3.2 (+types1.7.0,util4.3.0, which 6.3.2 depends on). 5.10.4 derivesaspectRatio: "w:h"fromwidth/height, which breaks poster URLs on player v4 (Supplying an aspect ratio AND the transformation parameter causes poster URLs to fail cloudinary/cloudinary-video-player#1087). 6.3.2 removed that specifically to unblock the v4 upgrade (cloudinary-community/cloudinary-util@c595c99). All url-loader/util/types symbols this package imports still exist in the new versions.copy-assets.ts.dist/fonts/*.svgdoes not exist on unpkg for 1.11.1 or 4.1.2 (the icons are inlined in the CSS), so the build has been writing unpkg's 404 HTML body intodist/fonts/*.svgfor a long time — that's whatnext-cloudinary@6.19.3ships today. Nothing in this repo or the docs referencesdist/fonts. With only one asset left, the loop'sstring/directorybranches were dead and got flattened.Compatibility notes (1.11.1 → 4.1.2)
dist/cld-video-player.min.jsis kept in v4 as the full, synchronous bundle (alias ofplayer-full.min.js), socloudinary.videoPlayer()still returns a realVideoPlayerinstance immediately;player.on()andplayer.videojs.cloudinary.dispose()— everythingCldVideoPlayer.tsxtouches — are unchanged.dist/cld-video-player.min.cssstill exists at the same path.getVideoPlayerOptions()emits (cloud_name,privateCdn,secureDistribution,publicId,transformation,posterOptions,showLogo/logoImageUrl/logoOnclickUrl,autoplayMode,sourceTypes, …) is still accepted by 4.x, and that the[{ quality: "auto" }, undefined]transformation array url-loader produces when notransformationprop is set builds correct source/poster URLs on 4.1.2.Test plan
pnpm build— succeeds;dist/cld-video-player.cssis the v4.1.2 stylesheet, nodist/fontspnpm test— 16/16 passtests/nextjs-app(Next 16 / React 19)npm run buildagainst the rebuilt package — succeeds<CldVideoPlayer width="1620" height="1080" src="…" />with and withoutanalytics: trueon a page that loads gtag.js; confirm playback, poster, and no console errors — I can't verify visually from here, so a maintainer sanity check in the browser would be appreciatedRelated: cloudinary/cloudinary-video-player#1092 hardens the same call site in the current player's
gtagpath.🤖 Generated with Claude Code