Skip to content

Docs: Playback Feature Reference Example Calls a Non-Existent toggle() Method #1520

@R-Delfino95

Description

@R-Delfino95

Which documentation could use some work?

  • React (@videojs/react)

Is this a discrepancy or an improvement?

  • discrepancy

🖊 Describe what you'd like to see change in the documentation

The React example on the feature-playback reference page calls playback.toggle:

return <button onClick={playback.toggle}>{playback.paused ? 'Play' : 'Pause'}</button>;

But the playback feature has no toggle() method. The actual API is togglePaused() (defined in packages/core/src/dom/store/features/playback.ts). The auto-generated reference table on the same page already lists togglePaused() correctly — the example just contradicts it. Anyone copy-pasting the snippet gets playback.toggle is undefined at runtime.

💡 Describe how you think this change will help the documentation

Update the example to use playback.togglePaused so it actually works when copied, and matches the API reference table directly above it.

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Ready for review

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions