Skip to content
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

feat: add url template for video player profiles #696

Merged
merged 9 commits into from
Oct 7, 2024

Conversation

jakub-roch
Copy link
Contributor

  • Add url template for video player profiles with support for staging env
  • Remove deprecated method videoPlayerWithProfile

@jakub-roch jakub-roch requested a review from a team as a code owner October 1, 2024 03:34
Copy link

netlify bot commented Oct 1, 2024

Deploy Preview for cld-video-player ready!

Name Link
🔨 Latest commit d833625
🔍 Latest deploy log https://app.netlify.com/sites/cld-video-player/deploys/670384573ca14c000899dc7a
😎 Deploy Preview https://deploy-preview-696--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 site configuration.

Copy link

netlify bot commented Oct 1, 2024

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

Name Link
🔨 Latest commit d833625
🔍 Latest deploy log https://app.netlify.com/sites/cld-vp-esm-pages/deploys/67038457b52aa3000868330a
😎 Deploy Preview https://deploy-preview-696--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 site configuration.

src/player.js Outdated Show resolved Hide resolved
Copy link
Contributor

@ehab-cl ehab-cl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 💪

playerWithCustomProfile.source('samples/cld-sample-video');
}, false);
</code>
</pre>
</div>

</body>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest adding another example with a custom profile and overriding configuration code to make sure it works as expected (It could be same page but two different players and i think this is even more favourable)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good point, added another example with overrides

src/player.js Outdated
}
const urlPrefix = unsigned_url_prefix(
null,
initOptions.cloudName || initOptions.cloud_name,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
initOptions.cloudName || initOptions.cloud_name,
initOptions.cloudName ?? initOptions.cloud_name,

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

src/player.js Outdated

throw new Error('Custom profiles will be supported soon, please use one of default profiles: "cldDefault", "cldLooping" or "cldAdaptiveStream"');
const profileUrl = isRawUrl(profile) ? profile : `${urlPrefix}/_applet_/video_service/video_player_profiles/${profile}.json`;
return await fetch(profileUrl, { method: 'GET' }).then(res => res.json());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the await here and the async in the function declaration are both redundant, but especially here it is really not needed

Suggested change
return await fetch(profileUrl, { method: 'GET' }).then(res => res.json());
return fetch(profileUrl, { method: 'GET' }).then(res => res.json());

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed, I would like to keep entire method as async just in case - so w need to have async declaration on the top but there await can be removed

@jakub-roch jakub-roch requested a review from tsi October 5, 2024 17:10
Comment on lines +11 to +20
const urlPrefix = unsigned_url_prefix(
null,
initOptions.cloudName ?? initOptions.cloud_name,
initOptions.private_cdn,
initOptions.cdn_subdomain,
initOptions.secure_cdn_subdomain,
initOptions.cname,
initOptions.secure,
initOptions.secure_distribution,
);
Copy link
Collaborator

@tsi tsi Oct 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jakub-roch instead of creating that list can't you use CLOUDINARY_CONFIG_PARAM, like in getConfig() ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image this helper requires specific properties, some of them are ignored like ```'shorten', 'sign_url', 'api_secret', 'url_suffix', 'use_root_path', 'auth_token'```

as I can see cloudinaryConfig provides same values as from initOptions

@jakub-roch jakub-roch merged commit d60cb4f into edge Oct 7, 2024
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.

3 participants