WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 3 years ago

#38544 closed defect (bug) (fixed)

Header Visuals > Header Video Vimeo url don't work

Reported by: llemurya Owned by: joemcgill
Milestone: 4.7 Priority: normal
Severity: normal Version: 4.7
Component: Customize Keywords: has-patch commit
Focuses: ui, javascript Cc:
PR Number:

Description

In Customizer in Header Visuals Section on Header Video option, when I paste a Vimeo url, for example
https://vimeo.com/185808340, the background header didn't appear, with Youtube it works as well.

Attachments (4)

custom-header-vimeo.php (1.4 KB) - added by bradyvercher 3 years ago.
Video header handler for Vimeo
38544.diff (614 bytes) - added by joemcgill 3 years ago.
38544.2.diff (949 bytes) - added by peterwilsoncc 3 years ago.
38544.3.diff (1.1 KB) - added by joemcgill 3 years ago.

Download all attachments as: .zip

Change History (22)

#1 @joemcgill
3 years ago

  • Keywords needs-patch added
  • Milestone changed from Awaiting Review to 4.7
  • Owner set to joemcgill
  • Status changed from new to accepted

Thanks @llemurya.

We currently don't have a handler defined to handle Vimeo URLs in wp-custom-header.js. We either need to write one, similar to the youtubeHandler() or note that only YouTube is supported in WordPress 4.7 and update the helper text in the customizer to be more accurate.

Additionally, we should consider how themes or plugins could extend the core functionality by adding their own handlers.

This ticket was mentioned in Slack in #core-themes by joemcgill. View the logs.


3 years ago

#3 @bradyvercher
3 years ago

Vimeo currently only supports background videos for Plus and PRO members and it's only experimental at this point, so there isn't a core handler for it.

The label in the Customizer needs to be updated to indicate that only YouTube is supported for now. There's also a validator for the external_video_header setting that probably needs to be updated or removed if it won't allow plugins to add additional handlers.

I'll try to put together a plugin to add Vimeo support as a proof of concept to see if anything needs to be adjusted to make adding new handlers easier.

@bradyvercher
3 years ago

Video header handler for Vimeo

#4 @bradyvercher
3 years ago

custom-header-vimeo.php is a basic plugin for adding Vimeo support. It uses their official player API, which doesn't contain support for the background setting mentioned earlier. To set that, the iframe would need to be constructed manually, but this at least shows how a custom handler can be registered.

#5 @celloexpressions
3 years ago

Plugins can hook into the customizer validity filter to remove an invalid notice if there's a source they're adding. So I think adjusting the label is all that will be needed here. This should definitely live as a plugin for now, and would be good to see it on .org if someone's able to make a fully-fledged version.

@joemcgill
3 years ago

#6 @joemcgill
3 years ago

Since the consensus is that we can't support Vimeo URLs by default, 38544.diff removes the reference to Vimeo from the description for the external header video controls.

#7 @joemcgill
3 years ago

  • Keywords has-patch added; needs-patch removed

#8 @joemcgill
3 years ago

  • Resolution set to fixed
  • Status changed from accepted to closed

In 39128:

Customize: Remove Vimeo reference from description for external header videos.

Vimeo's API requires a Pro account to display videos as background videos
(i.e., without player controls), thus we shouldn't support Vimeo
URLs by default in custom header videos. This removes the reference of Vimeo
from the control description in the customizer.

Fixes #38544.

#9 @ocean90
3 years ago

  • Keywords needs-patch added; has-patch removed
  • Resolution fixed deleted
  • Status changed from closed to reopened

_validate_external_header_video() should be updated as well. It's confusing that the error message says that you should enter a Vimeo URL even if it's not supported.

#10 @westonruter
3 years ago

Also, in \WP_Customize_Manager::_validate_external_header_video() it’s using esc_url() with a (default) display context. It probably won’t impact the validation logic as it stands right now, but esc_url() will inject HTML entities into the returned string, so that could cause unexpected behavior. In short, I think this should be changed to use esc_url_raw() instead.

#11 @peterwilsoncc
3 years ago

In 38544.2.diff:

  • updated error message
  • replaces esc_url with esc_url_raw (correct although benign in this context)

#12 @peterwilsoncc
3 years ago

  • Keywords has-patch added; needs-patch removed

#13 @joemcgill
3 years ago

  • Keywords commit added

Good catch @ocean90 and @westonruter. 38544.2.diff looks good (thanks @peterwilsoncc).

#14 @joemcgill
3 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

In 39148:

Customize: Remove Vimeo validation for external videos.

Following [39128], this removes the validation logic for Vimeo URLs from
_validate_external_header_video() since WP does not support the
display of videos from Vimeo by default.

This also includes a change to using esc_url_raw() instead of esc_url()
on the URL value to avoid unexpected behavior from the inclusion of HTML
entities.

Props peterwilsoncc, westonruter.
Fixes #38544.

#15 @afercia
3 years ago

  • Keywords needs-patch added; has-patch commit removed
  • Resolution fixed deleted
  • Status changed from closed to reopened

Was just commenting while @joemcgill committed [39148] :) I'd say to remove references to Vimeo from the inline documentation too, see * Ensures that the provided URL is for YouTube or Vimeo.. Probably also remove the regex for Vimeo from get_header_video_settings()

@joemcgill
3 years ago

#16 @joemcgill
3 years ago

  • Keywords has-patch added; needs-patch removed

38544.3.diff removes the mime type logic for Vimeo URLs from get_header_video_settings() and cleans up the docs for _validate_external_header_video().

#17 @westonruter
3 years ago

  • Keywords commit added

#18 @joemcgill
3 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

In 39165:

Themes: Remove Vimeo logic from header_video_settings().

Following [39148] and [39128], this removes the mime type logic for
Vimeo URLs from get_header_video_settings() and removes remaining
Vimeo reference from _validate_external_header_video() docs.

Fixes #38544.

Note: See TracTickets for help on using tickets.