Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not all URL parameters work in iframe embed player #14

Open
davidmpurdy opened this issue Sep 6, 2022 · 5 comments
Open

Not all URL parameters work in iframe embed player #14

davidmpurdy opened this issue Sep 6, 2022 · 5 comments
Labels
bug Something isn't working

Comments

@davidmpurdy
Copy link
Collaborator

It appears that the iframe player treats boolean parameters that are false by default as "true" if they are present at all in the querystring (even if they are set to false).

Affected parameters I've identified are muted, loop, and autoplay. (The behavior is documented for autoplay.)

For example, the following iframe src results in a video that does autoplay, start muted, and loop. (But does not show controls.)

https://iframe.cloudflarestream.com/uid123456?muted=false&preload=false&loop=false&autoplay=false&controls=false

I found this updating the block, but it affects shortcodes as well. For example, the following shortcode generates a URL like the one above which treats autoplay, loop, and muted as effectively true.

[cloudflare_stream uid="[uid]" controls="false" autoplay="false" loop="false" preload="false" muted="false"]

I've raised the issue of at least documenting the behavior, if not allowing false values.

I think the best solution is to add some logic to where querystring parameters are added in Cloudflare_Stream_API::get_video_embed to simply not add parameters that are falsy or "false".

I'm working on a PR now.

@B-Interactive
Copy link
Owner

Playing with the embed options in the Cloudflare Stream console, it would seem to confirm what you've found, and also for preload. The assumption that specifying the inverse would set it as such, was an error on my part.

Default when no options specified:

  • controls (true)
  • autoplay (false)
  • muted (false)
  • loop (false)
  • preload (false)

@davidmpurdy
Copy link
Collaborator Author

I didn't include preload because in my testing it looks to work a little differently - it appears to pass through to the <video> element if the value is valid, but if I recall seems to work OK with mapping false to none and true to auto.

I meant to raise a separate issue of how to handle it. The Stream documentation seems to suggest that it wants the HTML enumerated options, so maybe we should add a line to map true and false values on our end (seems worth keeping them working for backwards compatibility).

@B-Interactive B-Interactive added the bug Something isn't working label Sep 8, 2022
@B-Interactive
Copy link
Owner

Fix implemented in 1cb2038.

@davidmpurdy
Copy link
Collaborator Author

These seem to be broken again for me. At first glance from inspecting the page source and the iframe URL, I'm wondering if it has something to do with encoded ampersands...?

@B-Interactive
Copy link
Owner

Hopefully fixed now in 8b0b131.

I've reverted to the use of & instead of %26 and simultaneous multiple parameters test as working in LibreWolf under Linux and Edge under Windows.

The available advice was to percentage encode ampersands to %26 when used in URI's. I must be missing something because that clearly failed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
2 participants