Skip to content

Add API for changing metadata #161

Closed

Description

@sandersdan

An app may have a frame (video or audio) but want to change its metadata (timestamp, duration, colorspace) before passing it to another component. I propose that we extend clone() to take an initialization dictionary that allows this metadata to be overwritten in the clone. It would probably make sense for any introduced copy() API to do the same.

Activity

  1. padenot commented on Apr 6, 2021

    @padenot
    Collaborator

    Having the capability to do this would be very useful. With copy-on-write semantics your API suggestion sounds fine in terms of performance, but maybe a bit unfamiliar to developers.

  2. added
    extension
    on May 12, 2021
  3. chcunningham commented on May 12, 2021

    @chcunningham
    Collaborator

    Triage note: marked 'extension' as the proposal is describing adding new arguments to a method.

  4. padenot commented on May 17, 2021

    @padenot
    Collaborator

    I tend to agree in practice, but this is breaking in theory (.length on the method changes).

  5. sandersdan commented on May 21, 2021

    @sandersdan
    ContributorAuthor

    Note: now that we support construction from a CanvasImageSource, and VideoFrame is a CanvasImageSource, this can be written as new VideoFrame(originalFrame, { /* new metadata */ }), and Chrome's implementation already supports overriding a timestamp in this way.

    I think it may be surprising that this construction clones rather than copies, but the spec is already quite clear on this point.

    Maybe we don't actually need clone() at all?

  6. added
    editors-agenda
    on Jan 18, 2022
  7. chcunningham commented on Jan 18, 2022

    @chcunningham
    Collaborator

    @sandersdan what are your feelings as of late? Do you want to see metadata overrides added to clone() or is the VideoFrame constructor option sufficient? I can see it either way (i.e. symmetry is nice, but argument could also be made that clone() is the "simple" option).

  8. sandersdan commented on Jan 18, 2022

    @sandersdan
    ContributorAuthor

    I no longer feel strongly about copy() and clone() supporting these options. It would presumably be trivial to support that use, but the added complexity in teaching the API is probably not worth it.

    I suppose there is also the inverse to consider, an option for new VideoFrame() to force copy semantics. This has the advantage of actually highlighting the default clone behavior, but of course is not async which likely is a showstopper.

  9. chcunningham commented on Jan 19, 2022

    @chcunningham
    Collaborator

    Ok, lets close this for now. If we hear folks hate the current options we'll reconsider.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    editors-agendaextension

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions