Skip to content

Commit 06c2784

Browse files
committed
fix(youtube-player): YT.Player is not a constructor
fixes a race condition where window.YT would be truthy but window.YT.Player would not be ready. Fixes #20598
1 parent c21c6f5 commit 06c2784

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/youtube-player/youtube-player.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ export class YouTubePlayer implements AfterViewInit, OnDestroy, OnInit {
210210
}
211211

212212
let iframeApiAvailableObs: Observable<boolean> = observableOf(true);
213-
if (!window.YT) {
213+
if (!window.YT || !window.YT.Player) {
214214
if (this.showBeforeIframeApiLoads && (typeof ngDevMode === 'undefined' || ngDevMode)) {
215215
throw new Error('Namespace YT not found, cannot construct embedded youtube player. ' +
216216
'Please install the YouTube Player API Reference for iframe Embeds: ' +

0 commit comments

Comments
 (0)