xgplayer

bytedanceMIT活跃维护

字节跳动开源的 HTML5 视频播放器,内置流媒体解析能力,支持 HLS、DASH、FLV 等格式,通过按需解析节省流量。

A HTML5 video player with a parser that saves traffic

v3.0.27发布于 2026-10-29 03:30 UTC9,310star946fork同步于 2026-11-10 17:31 UTC

怎么上手

由 README 提炼,执行前请确认
npm install xgplayer
硬件要求按 README 说明

README 未说明

下载:源码 zip·GitHub Releases(安装包)本站不镜像安装包

项目说明

由 README 自动翻译提炼

字节开源的插件化 HTML5 播放器,UI、加载策略和格式集成可独立组合

字节跳动开源的 HTML5 视频播放器,内置流媒体解析能力,支持 HLS、DASH、FLV 等格式,通过按需解析节省流量。

核心能力

  • 插件化架构,UI 组件与加载策略可独立组合
  • 内置 UI 插件,另提供流媒体与功能扩展包
  • 支持 HLS、FLV、MP4 等格式的独立开发调试
  • 提供完整配置项文档,可自定义播放器选项

容易踩的坑

HLS、FLV 等流媒体能力需额外引入对应插件包,核心包不含;仓库开发使用 Yarn 1.x,用其他包管理器跑 demo 可能出问题;需额外引入 xgplayer/dist/index.min.css,否则样式缺失

内容由模型根据 README 生成,可能不完整或不准确,以官方文档为准。看原文 README

最近发版

5 个版本v3.0.27
  1. v3.0.27最新正式版2026-10-29 · 2026-10-29 03:30 UTC

    3.0.27 (2026-10-28)

    Features

    • mp3: Add standalone MP3 MSE playback with Range seek and native fallback. (65f8649)
    • mp4: xgplayer-mp4 can now play on MSE/ManagedMediaSource (iOS 17.1+) via preferMMS, instead of always degrading to native video. (322888e), closes #1932
    • range请求,增加 数据范围是否匹配检测 (03a109c)
    • support dynamic-timeout timeoutRatio, xhr fix endless request because of unpected net response (2c89a2c)
    • 优化range请求时,返回200状态码问题 (e43c93b)

    Bug Fixes

    • dash: parse MPD durations with any combination of H, M and S (f9c8ad2)
    • hls: preserve playlist path for query-only URIs (5af9e7d)
    • hls: Prevent fixture values from being interpreted as HTML. (202d5f6)
    • monorepo: Harden cast lifecycle handling and TypeScript buffer compatibility. (2f135fc)
    • monorepo: Include package changelogs in npm distributions. (87cf0de)
    • monorepo: Keep package changelogs and published archives consistent across tag-driven releases. (6af6c83)
    • monorepo: Reject outdated release tags before generating package metadata. (f3d83ce)
    • mp4: Fix fragmented MP4 playback, source switching, buffer eviction, and stall recovery in xgplayer-mp4. (3c417a5), closes #1875 #1911 #1932 #1935
    • transmuxer: accept minimum 4-byte UTF-8 sequence U+10000 (ea781cd)
    • transmuxer: Avoid emitting zero-duration video samples for PES data without timestamps. (65b6a0e)
    • transmuxer: Fix HEVC decode failures across implicit stream discontinuities. (d72119a)
    • transmuxer: Keep video samples after timestamp recovery. (4aabb65)
    • xgplayer-mp3: Add MP3 range-loading playback support with safer teardown and native fallback behavior. (613c02b)
    • xgplayer-mp3: Fix MP3 completion, backward seeking, source preprocessing, native fallback state, and VBR seek metadata. (fe8049c)
    • xgplayer-mp3: Fix MP3 range loading, seeking, duration correction, and playNext lifecycle edge cases. ([df01285](https://github.com/bytedance/xgplayer/
  2. v3.0.27-rc.11pre-release2026-10-21 · 2026-10-21 13:29 UTC
    查看更新说明
  3. v3.0.27-rc.10pre-release2026-10-21 · 2026-10-21 08:28 UTC
    查看更新说明
  4. v3.0.27-rc.9pre-release2026-10-21 · 2026-10-21 08:18 UTC
    查看更新说明
  5. v3.0.27-rc.8pre-release2026-10-21 · 2026-10-21 07:02 UTC
    查看更新说明

用户点评

登录用户的真实使用记录,可按版本和硬件筛选
共 0 条

    还没有人点评。第一个说出真实体验的人最有价值。

    README 原文

    未翻译

    xgplayer

    xgplayer provides a flexible, plugin-based media player for web applications. Its UI components, loading strategies, and format integrations can be composed independently.

    Documentation

    Installation

    npm install xgplayer
    

    Usage

    <div id="player"></div>
    
    import Player from 'xgplayer'
    import 'xgplayer/dist/index.min.css'
    
    const player = new Player({
      id: 'player',
      url: 'https://s2.pstatp.com/cdn/expire-1-M/byted-player-videos/1.0.0/xgplayer-demo.mp4'
    })
    

    See the configuration documentation for additional player options.

    Plugins

    xgplayer provides built-in UI plugins and optional streaming or feature packages. See the plugin documentation for available integrations.

    Development

    The repository uses Yarn 1.x. Fixture commands start local demos for each format:

    yarn
    yarn dev:xgplayer
    
    yarn dev:hls
    yarn dev:flv
    yarn dev:mp4
    

    Release

    See the release guideline for stable and prerelease workflows.

    License

    By using xgplayer, you agree to the following terms:

    1. xgplayer is licensed under the MIT License.
    2. You authorize the xgplayer project to display the logo of a business using xgplayer on the project website.