Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@gradosevic
Copy link

Feature: Placeholder Support for Caption Styling Persistence

This PR adds two non-functional placeholder methods to the Player class:

  • getTextTrackStyle()
  • setTextTrackStyle(style)

The goal is to enable future support for persistent subtitle styling across videos — something Vimeo users frequently request.

Suggested API Behavior (once implemented):

{
  "font": {
    "family": "Proportional Sans-Serif",
    "color": "#FFFFFF",
    "size": "100%",
    "opacity": "100%",
    "edgeStyle": "none"
  },
  "background": {
    "color": "#000000",
    "opacity": "100%"
  },
  "window": {
    "color": "#000000",
    "opacity": "0%"
  }
}

Developers would be responsible for persisting this style client-side (e.g. in cookies/localStorage). Vimeo would only need to expose the current value and allow setting it via postMessage.

Optional Future Enhancement

Emit a 'texttrackstylechange' event when the user changes subtitle style via the UI, so developers can respond or save it.

This addition lays the groundwork for caption consistency without breaking changes. No styling logic is implemented — only safe stubs with inline TODOs.

Suggested postMessage Format

If supported in the future, the player iframe could emit style changes via:

window.parent.postMessage(
  {
    event: 'texttrackstylechange',
    data: {
      font: {
        family: 'Proportional Sans-Serif',
        color: '#FFFFFF',
        size: '100%',
        opacity: '100%',
        edgeStyle: 'none'
      },
      background: {
        color: '#000000',
        opacity: '100%'
      },
      window: {
        color: '#000000',
        opacity: '0%'
      }
    }
  },
  '*'
);

This would allow consumers of the Player API to persist caption styles on their side:

player.on('texttrackstylechange', (style) => {
  localStorage.setItem('captionStyle', JSON.stringify(style));
});

No storage or UI changes are needed from Vimeo — just a simple message emit.

Final Note

I understand this feature would require internal support from the Vimeo iframe, but I hope this PR provides a clean starting point. It introduces no breaking changes and keeps all logic on the developer’s side — Vimeo simply needs to expose and optionally emit the current caption style.

I'd be happy to iterate further if the team sees potential in enabling this capability. Thank you for your consideration!

@CLAassistant
Copy link

CLAassistant commented Jul 25, 2025

CLA assistant check
All committers have signed the CLA.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants