-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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
YouTube player features #28171
Conversation
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`.
0545e93
to
737ab03
Compare
}; | ||
script.addEventListener('load', callback); | ||
script.addEventListener('error', callback); | ||
(script as any).src = url; |
There was a problem hiding this comment.
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.
737ab03
to
2b4c7cc
Compare
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
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.