@glomex/integration-react

中文文档
1.1597.2发布于 2026/10/31MITTypeScriptES Module零依赖近 30 天下载 2872

用于整合 glomex 播放器的反射组件

中文使用文档
文档目录4 节
  1. 导言
  2. 关于闪光剂
  3. 使用量
  4. 正在装入并整合播放器( TypeScript)

@ glomex/ 整合- 反应

导言

@glomex/integration-react 曝光一个反应组件和类型,以方便地整合 glomex 播放器. 要使用此组件, 您需要有一个 glomex 账户 。 你可以通过遵守指令来获得一个 开始 节.

关于闪光剂

光泽 经营着德国最大的高价视频内容市场。 我们的平台连接出版商,内容创作商,广告商,使得高质量的视频内容能够无缝地在网络上畅通地发售.

我们的生态系统旨在为所有参与者创造价值:

  • 出版商 获得优质视频内容和货币化机会
  • 内容拥有者 其视频资产获得广泛的分配和收入
  • 广告商 覆盖优质网站网络的目标受众

使用量

正在装入并整合播放器( TypeScript)

// example: player.tsx
import { useEffect, useRef, type ComponentProps, type ComponentRef } from 'react';
import { Integration, IntegrationEvent } from '@glomex/integration-react';

const Player = (props: ComponentProps<typeof Integration>) => {
  const integrationRef = useRef<ComponentRef<typeof Integration>>(null);

  const handlePlay = () => {
    integrationRef.current?.ready.then(() => integrationRef.current?.play());
  };

  const handleContentStart = () => {
    console.log('content start', integrationRef.current?.content);
  };

  useEffect(() => {
    integrationRef.current?.ready.then(() => {
      // interact with the API after initial ready
      if (!integrationRef.current) return;
      // e.g. start at 20 seconds
      integrationRef.current.currentTime = 20;
      // integrationRef.current.volume = 0.1
      // integrationRef.current.muted = true
      // integrationRef.current.play();
    });
    // addEventListener is available immediately (without ready)
    integrationRef.current?.addEventListener(
      IntegrationEvent.CONTENT_START,
      handleContentStart
    );
    return () => {
      integrationRef.current?.removeEventListener(
        IntegrationEvent.CONTENT_START,
        handleContentStart
      );
    };
  }, [integrationRef]);

  return (
    <div>
      <Integration
        ref={integrationRef}
        {...props}
      />
      <button type="button" onClick={handlePlay}>
        Play
      </button>
    </div>
  );
};

export default Player;

使用量 在组件中:

// example: app.tsx
import Player from "./player"

export default async function MyApp(props) {
  const params = await props.params

  return (
    <div>
      <Player
        integrationId="YOUR_INTEGRATION_ID"
        playlistId="YOUR_PLAYLIST_ID"
      />
    </div>
  );
}

版本与发布记录

@glomex/integration-react 共发布 498 个版本,首次发布于 2025/04/07;过去 12 个月发布了 250 个版本。

版本发布日期距今
1.1597.2latest2026/10/3116 天前
1.1596.52026/10/2324 天前
1.1596.42026/10/2324 天前
1.1596.32026/10/2225 天前
1.1596.22026/10/2126 天前
1.1596.12026/10/2027 天前

关于 @glomex/integration-react 的常见问题

@glomex/integration-react 是什么?

用于整合 glomex 播放器的反射组件

如何安装 @glomex/integration-react?

在项目目录运行 npm install @glomex/integration-react,或使用 pnpm add / yarn add / bun add。

@glomex/integration-react 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@glomex/integration-react 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@glomex/integration-react 可以商用吗?

@glomex/integration-react 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@glomex/integration-react 的下载量有多少?

根据 npm 官方下载统计,@glomex/integration-react 在 2026/10/17 – 2026/11/15 这 30 天内被下载 2,872 次,日均约 96 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@glomex/integration-react 还在维护吗?

最新版本 1.1597.2 发布于 2026/10/31(16 天前);至今共发布 498 个版本,其中过去 12 个月发布了 250 个;首次发布于 2025/04/07。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。