npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@mm-player/player

v1.3.0

Published

播放器兼容入口(聚合 player-core + player-ui + player-enterprise)

Readme

@mm-player/player

mm-player 聚合入口(shim):直接导出 player-coreplayer-ui 的命名 API,并以 enterprise 命名空间暴露 player-enterprise

模块用途

提供单一入口。源码已拆分为 Headless 核心(player-core)、UI 层(player-ui)和企业插件基础设施(player-enterprise);Core/UI 继续使用命名导出,Enterprise 使用命名空间以避免与 UI 包的 PluginManifest / PluginPermission 同名冲突。

适用场景

  • 不需要按需 tree-shaking、希望一次导入拿到全部 API 的场景。
  • 从旧版 @mm-custom/player 迁移、希望保持导入路径不变。

需要最小体积或仅用核心/UI 之一时,优先按需导入子包:

import { PlayerCore } from '@mm-player/player-core';      // 仅 Headless 核心
import { PlayerUI } from '@mm-player/player-ui';          // 仅 UI
import { WhenAdapter } from '@mm-player/player-core/adapters'; // 仅适配器

引入

pnpm add @mm-player/player

最小示例

import { PlayerUI } from '@mm-player/player';

const player = new PlayerUI({
  container: '#player',
  url: 'https://example.com/stream.mpd',
  adapter: 'shaka'
});

player.on('error', (err) => console.error(err));
await player.play();

await player.destroy();
<mm-player src="https://example.com/stream.flv" protocol="flv" controls></mm-player>
<script type="module">
  import '@mm-player/player'; // 注册 <mm-player>
</script>

Enterprise 命名空间

import { enterprise } from '@mm-player/player';

const registry = new enterprise.PluginRegistry();
const runtime = new enterprise.PluginRuntime();
const bus = new enterprise.PluginEventBus();

直接安装企业包时仍可使用 import { PluginRegistry } from '@mm-player/player-enterprise'

关键 API

本包不实现播放器逻辑,聚合方式如下:

  • @mm-player/player-corePlayerCoreStateManagerCommandBusPlayerEngineMediaTech、类型与常量等。
  • @mm-player/player-core/adaptersWhenAdapter(WHEP)、FlvAdapter(FLV)、ShakaAdapter(DASH/HLS)。
  • @mm-player/player-uiPlayerUIMMPlayerElement<mm-player>)、Renderer、Theme、VideoMediaTech、插件类型等。
  • @mm-player/player-enterprise:通过 enterprise 命名空间提供 PluginEventBusPluginHookSystemPluginInspector 等。

完整 API 见各子包 README 与 docs/api.md

生命周期与资源释放

PlayerUI / PlayerCore 一致:stopdestroy 均为异步,必须 awaitdestroy 幂等。详见 player-ui READMEplayer-core README

常见错误与注意事项

  • shim 构建把三个子包作为 external(不打进产物),产物体积最小;运行时需安装子包(已声明为 workspace:^ / dependencies)。
  • WHEP 适配器公开类名为 WhenAdapter(历史命名,非拼写错误)。
  • volume 范围 0–1(默认 1)。
  • 构造签名为 new PlayerCore(config?, tech?)techMediaTech,非 video 元素);浏览器侧 UI 由 PlayerUI 内部注入 VideoMediaTech,无需手动传 tech。

相关文档