videojs/video.js · error · Error
Illegal plugin name, "${name}", cannot share a name with an
Error message
Illegal plugin name, "${name}", cannot share a name with an existing player method! What it means
registerPlugin adds the plugin as a method on Player.prototype, so its name must not collide with an existing Player.prototype own property. A collision would shadow a core player method (e.g. 'play', 'src') and silently break playback, so registration refuses. Note: a duplicate plugin name only warns; this throw is specifically for Player method collisions.
Source
Thrown at src/js/plugin.js:354
* must not match an existing plugin or a method on the `Player`
* prototype.
*
* @param {typeof Plugin|Function} plugin
* A sub-class of `Plugin` or a function for basic plugins.
*
* @return {typeof Plugin|Function}
* For advanced plugins, a factory function for that plugin. For
* basic plugins, a wrapper function that initializes the plugin.
*/
static registerPlugin(name, plugin) {
if (typeof name !== 'string') {
throw new Error(`Illegal plugin name, "${name}", must be a string, was ${typeof name}.`);
}
if (pluginExists(name)) {
log.warn(`A plugin named "${name}" already exists. You may want to avoid re-registering plugins!`);
} else if (Player.prototype.hasOwnProperty(name)) {
throw new Error(`Illegal plugin name, "${name}", cannot share a name with an existing player method!`);
}
if (typeof plugin !== 'function') {
throw new Error(`Illegal plugin for "${name}", must be a function, was ${typeof plugin}.`);
}
pluginStorage[name] = plugin;
// Add a player prototype method for all sub-classed plugins (but not for
// the base Plugin class).
if (name !== BASE_PLUGIN_NAME) {
if (Plugin.isBasic(plugin)) {
Player.prototype[name] = createBasicPlugin(name, plugin);
} else {
Player.prototype[name] = createPluginFactory(name, plugin);
}
}
View on GitHub (pinned to c3a7e0e6d2)
Solutions
- Choose a name that does not match a Player.prototype method (e.g. 'myPlay' instead of 'play').
- Check before registering: if (videojs.Player.prototype.hasOwnProperty(name)) throw.
- Namespace plugin names with a prefix to avoid collisions.
Example fix
// before
videojs.registerPlugin('src', myPlugin); // collides
// after
videojs.registerPlugin('mySrc', myPlugin); Defensive patterns
Strategy: validation
Validate before calling
function safeRegisterPlugin(name, plugin) {
if (videojs.Player.prototype.hasOwnProperty(name)) {
throw new Error(`'${name}' collides with a Player method`);
}
return videojs.registerPlugin(name, plugin);
} Type guard
const collidesWithPlayerMethod = (name) => videojs.Player.prototype.hasOwnProperty(name);
Prevention
- Namespace plugin names (e.g. 'myPluginSrc') to avoid collisions.
- Cross-check new names against the Player API.
- Avoid generic verbs: play, load, src, volume.
When it happens
Trigger: Calling videojs.registerPlugin('play', fn), registerPlugin('src', fn), or any name matching an own property on Player.prototype (src, load, pause, currentSrc, etc.).
Common situations: Generic plugin names like 'play', 'load', 'volume', 'src'; auto-generating plugin names from feature data without checking against Player API; renaming a plugin to a reserved name.
Related errors
- Can not register Player component after player has been crea
- plugin "${name}" does not exist
- No Tech named '${titleTechName}' exists! '${titleTechName}'
- Illegal plugin name, "${name}", must be a string, was ${type
- Illegal plugin for "${name}", must be a function, was ${type
AI-assisted analysis of videojs/video.js@c3a7e0e6d2 (2026-08-13).
Data as JSON: /api/errors/11ff046ee6f72f9c.
Report an issue: GitHub.