verbb / vizy

A flexible visual editor for Craft CMS
Other
44 stars 8 forks source link

Youtube "Live" URLs causes error in CP, not in front-end #280

Closed johndwells closed 7 months ago

johndwells commented 7 months ago

Describe the bug

We have a simple Vizy field that allows media embeds; when we paste in a "live" URL from Youtube, e.g.:

https://www.youtube.com/live/PQUJy2s16v8?si=1H_DeAoQsfbS8zZP

The field renders it as an error:

Error: No provider found with given url "https://www.youtube.com/live/PQUJy2s16v8?si=thw45oG2j_aJtfSL" Error: No provider found with given url "https://www.youtube.com/live/PQUJy2s16v8?si=thw45oG2j_aJtfSL" at UZ (https://domain.com/cpresources/d763ef71/assets/vizy-a7503afa.js:220:83845) at Proxy.initEmbed (https://domain.com/cpresources/d763ef71/assets/vizy-a7503afa.js:220:85225) at Proxy. (https://domain.com/cpresources/d763ef71/assets/vizy-a7503afa.js:220:85107)

That "live" URL, when visited, redirects to a more traditional "watch" URL:

https://www.youtube.com/watch?v=PQUJy2s16v8

I can paste this URL into the Media Embed and it works as expected.

We also have the Embedded Assets plugin installed, which also works with oembed, and it handles the "live" URL fine. So I think that is a valid URL from an oembed pov.

Steps to reproduce

  1. Configure a standard Vizy field, with a Media Embed button available 2.Paste in a "live" URL, e.g. https://www.youtube.com/live/PQUJy2s16v8?si=1H_DeAoQsfbS8zZP

Craft CMS version

4.7.1

Plugin version

2.1.15

Multi-site?

No

Additional context

No response

engram-design commented 7 months ago

Interesting! We don't actually use the same oembed package Embedded Assets does, we use oembed-extractor which is client-side.

It looks like that URL isn't even supported at the oembed spec. But then the embed/embed package (which Embedded Assets uses) seems to not support the /live path either...

But, we can add a fix on our end for this. Fixed for the next release. To get this early, run composer require verbb/vizy:"dev-craft-4 as 2.1.15".

johndwells commented 7 months ago

How bizarre... you know, when you follow the "live" URL in the browser, it redirects to the more traditional "watch" URL. I wonder if the difference is that oembed-extractor doesn't follow those redirects, whereas embed/embed does?

It's frustrating because when you go to "share" a live video, it gives that "live" URL format, but clearly "watch" works too. But just, how to explain that to a client! :)

engram-design commented 7 months ago

Fixed in 2.1.16