Skip to content

YouTube videos with IDs containing hyphens fail to embed #4504

@westonruter

Description

@westonruter

Bug Description

Embedding a video from YouTube containing a hyphen in the ID is failing to embed in v1.5, where it worked in v1.4.

Embedding this video for example: https://www.youtube.com/watch?v=xo68-iWaKv8

In 1.4.4:

<figure class="wp-block-embed-youtube wp-block-embed is-type-video is-provider-youtube  wp-has-aspect-ratio">
	<div class="wp-block-embed__wrapper">
		<amp-youtube data-videoid="xo68-iWaKv8" layout="responsive" width="16" height="9"></amp-youtube>
	</div>
</figure>

In 1.5.1:

<figure class="wp-block-embed-youtube wp-block-embed is-type-video is-provider-youtube  wp-has-aspect-ratio">
	<div class="wp-block-embed__wrapper">
		<amp-youtube data-videoid="xo68" layout="responsive" width="16" height="9" title="Standing Tall For Dwarfism: Quaden Bayles">
			<a placeholder href="https://youtu.be/xo68-iWaKv8" class="monsterinsights-internal-as-outbound" data-vars-category="outbound-link-int" data-vars-action="https://youtu.be/xo68-iWaKv8" data-vars-label="">
				<amp-img src="https://i0.wp.com/i.ytimg.com/vi/xo68/hqdefault.jpg?w=1220&amp;ssl=1" layout="fill" object-fit="cover" alt="Standing Tall For Dwarfism: Quaden Bayles" class="amp-wp-enforced-sizes">
					<noscript>
						<img src="https://i0.wp.com/i.ytimg.com/vi/xo68/hqdefault.jpg?w=1220&amp;ssl=1" alt="Standing Tall For Dwarfism: Quaden Bayles">
					</noscript>
				</amp-img>
			</a></amp-youtube>
	</div>
</figure>

Notice how the video ID is truncated from xo68-iWaKv8 to xo68.

Expected Behaviour

Video IDs containing hyphens should render properly.

Steps to reproduce

  1. Embed a YouTube video: https://www.youtube.com/watch?v=xo68-iWaKv8
  2. View the AMP page
  3. Notice a broken player

Screenshots

image

Additional context

  • WordPress version: 5.4
  • Plugin version: 1.5.1

Issue may have been introduced in #3358 or #3678.

Reported in this support topics:


Do not alter or remove anything below. The following sections will be managed by moderators only.

Acceptance criteria

Implementation brief

QA testing instructions

Demo

Changelog entry

Metadata

Metadata

Assignees

Labels

BugSomething isn't workingEmbedsP0High priority

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions