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

YouTube player features #28171

Merged
merged 2 commits into from
Nov 22, 2023
Merged

YouTube player features #28171

merged 2 commits into from
Nov 22, 2023

Conversation

crisbeto
Copy link
Member

Includes the following new features for the YouTube player component:

feat(youtube-player): coerce inputs

Adds input coercion support to the youtube-player component. Previously we couldn't do it because we didn't want to introduce a dependency to @angular/cdk.

feat(youtube-player): automatically load youtube api

Currently users have to load the YouTube API themselves which can be tricky to get right and be prone to race conditions. Since there's only one way to load it, these changes switch to doing so automatically. Loading the API automatically also enables us to optimize the component further in a follow-up PR by showing a placeholder image.

If users don't want the API to be loaded automatically, they can disable it through an input or using the newly-introduced YOUTUBE_PLAYER_CONFIG injection token.

Fixes #17037.

Note: there was an earlier attempt at this feature in #21401 which didn't land due to some concerns around API loading. We've discussed this with @jelbourn and agreed that they're no longer a problem.

Adds input coercion support to the `youtube-player` component. Previously we couldn't do it because we didn't want to introduce a dependency to `@angular/cdk`.
@crisbeto crisbeto added P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent target: minor This PR is targeted for the next minor release merge: preserve commits When the PR is merged, a rebase and merge should be performed labels Nov 22, 2023
@angular-robot angular-robot bot added the detected: feature PR contains a feature commit label Nov 22, 2023
@crisbeto crisbeto force-pushed the youtube-player-load branch 2 times, most recently from 0545e93 to 737ab03 Compare November 22, 2023 09:51
};
script.addEventListener('load', callback);
script.addEventListener('error', callback);
(script as any).src = url;
Copy link
Member Author

Choose a reason for hiding this comment

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

The as any here is to keep the security test happy. This isn't an XSS risk since we always load https://www.youtube.com/iframe_api.

Currently users have to load the YouTube API themselves which can be tricky to get right and be prone to race conditions. Since there's only one way to load it, these changes switch to doing so automatically. Loading the API automatically also enables us to optimize the component further in a follow-up PR by showing a placeholder image.

If users don't want the API to be loaded automatically, they can disable it through an input or using the newly-introduced `YOUTUBE_PLAYER_CONFIG` injection token.

Fixes angular#17037.
@crisbeto crisbeto removed the request for review from andrewseguin November 22, 2023 11:20
@crisbeto crisbeto added the action: merge The PR is ready for merge by the caretaker label Nov 22, 2023
@crisbeto crisbeto merged commit e0414b1 into angular:main Nov 22, 2023
26 checks passed
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Dec 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker detected: feature PR contains a feature commit merge: preserve commits When the PR is merged, a rebase and merge should be performed P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent target: minor This PR is targeted for the next minor release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

FR: YouTube / Google Maps should load the API itself
2 participants