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

Preload behaviour for video embed #19

Open
B-Interactive opened this issue Sep 14, 2022 · 2 comments
Open

Preload behaviour for video embed #19

B-Interactive opened this issue Sep 14, 2022 · 2 comments
Labels
discussion Nutting an idea out

Comments

@B-Interactive
Copy link
Owner

Touched on here, the Cloudflare Stream Player's preload attribute has a little more to it than simply true or false. The attribute is considered a hint for browsers on how to handle preloading, so the behaviour may vary. If I understand, the hints mean the following:

  • preload=none / preload=metadata / not specifying anything
    Any of the above will just load the metadata needed to start video playback when requested.

  • preload=auto
    Will preload the beginning of the video.

  • preload=true
    Will preload the entire video.

As of 1cb2038, preload=auto is used when preload is requested by a shortcode. I considered this a safer option, as preload=true could result in bill shock, and a poor end-user experience, if the implications aren't fully understood.

Open to discussion:

  1. Is auto the appropriate default when preloading is requested?
  2. Might the ability for the user to specify preload behaviour of beginning (auto) or entire video (true) be useful?
@B-Interactive B-Interactive added the discussion Nutting an idea out label Sep 14, 2022
@B-Interactive B-Interactive changed the title Better control of preload behaviour for video embed Preload behaviour for video embed Sep 14, 2022
@davidmpurdy
Copy link
Contributor

My understanding is that those are the only three valid options for the preload attribute (none, metadata, and auto).

Does true actually do anything (different than auto)? If not, I was apparently just being pedantic in my earlier comment about it not being binary. I can't see a real-world reason to set it to none (and Stream may not respect it anyway), so in practice it's probably a binary of metadata or auto.

I think the shortcode could map the values:

  • auto and true -> auto
  • metadata and false -> metadata
  • none -> none

It seems like a toggle probably does work for the block:

  • "on" state -> auto
  • "off" state -> metadata

If nothing is set in the shortcode, metadata seems like a good default since it's the recommendation in the spec (per the above MDN link) and the Stream platform default.

@B-Interactive
Copy link
Owner Author

B-Interactive commented Sep 14, 2022

I think you're right, it is only those three (none, metadata, and auto). I went and re-checked my references and it looks like I misunderstood it. I thought I saw true described in a forum comment, but I can't put my finger on it now.

In any case, that considerably simplifies how it's approached.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion Nutting an idea out
Projects
None yet
Development

No branches or pull requests

2 participants