`external_video_url` doesn’t update the `origin` URL parameter for YouTube videos
nikitaourazbaev opened this issue · comments
The external_video_url
filter doesn’t update the origin
URL parameter for YouTube embeds when using a preview URL. This is a URL parameter that the filter generates automatically. The origin mismatch breaks messaging to and from the iframe on preview URLs. The filter also includes the country part of the URL, breaking embed interaction on non-native-language stores.
Passing an explicit value to it with something like external_video_url: origin: request.origin
doesn't seem to affect the output, the parameter is ignored.
This is also affecting us and causing support debt.
Referencing Google's documentation - https://developers.google.com/youtube/player_parameters#origin
you should always specify your domain as the origin parameter value
Shopify is not passing the correct domain, and not only the domain.
To show an example, here's what that this filter creates on a French version of a store:
<iframe frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen="allowfullscreen" class="js-youtube" loading="lazy" src="https://www.youtube.com/embed/qV5lzRHrGeg?autoplay=1&controls=1&enablejsapi=1&loop=0&modestbranding=1&origin=https%3A%2F%2Fmy-dev-store.myshopify.com%2Ffr&playlist=qV5lzRHrGeg&playsinline=1&rel=0" title="Multiple videos"></iframe>
This should not have "%2Ffr" at the end:
origin=https%3A%2F%2Fmy-dev-store.myshopify.com%2Ffr