Skip to content

Container doesn't resize if YouTube API has already been loaded #38

@taylortom

Description

@taylortom

Container doesn't resize if YouTube API has already been loaded, ending up in a vertically cropped video.

Code-wise, we get an early return and the relevant initialisation doesn't occur.

if (window.onYouTubeIframeAPIReady !== undefined) return;

Example use-case: Adapt embedded in a page which had already loaded the API via another script (in this case Google tag manager). In this case, it means the code returns early, as window.onYouTubeIframeAPIReady is already defined. We've fixed this by forcibly changing the logic in the above code to check for Adapt.youTubeIframeAPIReady, rather than window.onYouTubeIframeAPIReady !== undefined, however this has the potential to cause issues with whatever code loaded the API originally.

Your environment

  • FW v5.51.2
  • adapt-youtube v3.3.0

Steps to reproduce

Load component in a page that has already loaded the API.

Expected behaviour

Component should resize to contain the full video.

Actual behaviour

Video will be cropped.

Metadata

Metadata

Assignees

Labels

Type

No fields configured for Bug.

Projects

Status

Assigned

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions