rx-player

canalplusApache-2.0活跃维护

基于 TypeScript 的 HTML5 视频播放器,支持 DASH、Smooth Streaming 和直播流,通过 MSE/EME 处理自适应码率与 DRM 播放。

DASH/Smooth HTML5 Video Player

v4.5.0发布于 2026-07-06 17:49 UTC936star139fork同步于 2026-11-10 11:52 UTC

怎么上手

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

README 未说明硬件要求;运行在支持 Media Source Extensions 与 Encrypted Media Extensions 的浏览器中。

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

项目说明

由 README 自动翻译提炼

基于 MSE/EME 的 DASH 与 Smooth Streaming 播放引擎,只做流媒体核心,界面由你实现

基于 TypeScript 的 HTML5 视频播放器,支持 DASH、Smooth Streaming 和直播流,通过 MSE/EME 处理自适应码率与 DRM 播放。

核心能力

  • 支持 DASH、Smooth Streaming,兼容浏览器可播 HLS 与直连文件
  • 核心逻辑可放入独立线程,避免阻塞主应用
  • 处理多 DRM 密钥、无法解密或解码质量时的自动回退
  • 支持 TTML、WebVTT、SAMI、SRT 字幕
  • 提供最小构建,按需引入 DASH、EME 等特性减小体积

容易踩的坑

这是无 UI 的播放核心库,需自行提供播放界面;HLS 与 MP4/WebM 仅在兼容浏览器的 directfile 模式下支持;大体积 DASH Manifest 可选用 WebAssembly 版 MPD 解析器。

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

最近发版

5 个版本v4.5.0
  1. v4.5.0最新正式版2026-07-06 · 2026-07-06 17:49 UTC

    Release v4.5.0 (2026-07-06)

    :mag: Overview

    This new release adds several fixes and features:

    • The biggest update here is on the MULTI_THREAD experimental feature: applications can now rely on manifestLoader, segmentLoader and representationFilter callbacks in "multithreading mode".

      This is done by letting you build your own separate RxPlayer worker bundle, through a wrapper with a simple API exported from the rx-player/experimental/worker path. Once bundled you can then provide the resulting file/build to the RxPlayer's usual attachWorker API.

    • Moreover, it's now possible through the same worker bundle feature to add "transport" features that were previously unavailable in multithreading mode: SMOOTH, LOCAL_MANIFEST and METAPLAYLIST.

      This means that no feature should now be missing from the multithreading mode, aside from directfile which would not really profit from it anyway.

    • We also have done a big internal change now that we're planning to remove the "experimental" label from the MULTI_THREAD feature: a large part of the monothreaded and multithreaded codebase has been merged into one shared path. This should simplify maintenance and make future behavior differences between both modes less likely.

    • We added more information to MEDIA_TIME_BEFORE_MANIFEST and MEDIA_TIME_AFTER_MANIFEST errors

    • We fixed multiple Safari / native-HLS edge cases

    • We improved DASH thumbnail handling

    • We fixed a small memory leak linked to quality changes

    • and we brought several smaller API and playback behavior improvements.

    Changelog

    Features

    • MULTI_THREAD: Allow applications to define their own representationFilter, segmentLoader and manifestLoader callbacks worker-side [#1719]
    • MULTI_THREAD: Enable adding most transport features worker-side (DASH, DASH_WASM, SMOOTH, LOCAL_MANIFEST and METAPLAYLIST) to play them in "multithreading" mode [#1783]
    • MediaError with the code MEDIA_TIME_BEFORE_MANIFEST and MEDIA_TIME_AFTER_MANIFEST now have a timeInfo property to make explicit the exact boundaries and present position linked to the issue [#1838]

    Bug fixes

    • Fix memory leak linked to quality changes [#1781]
    • DRM: When a license request times out, now send a KEY_LOAD_TIMEOUT error instead of KEY_LOAD_ERROR
    • DRM: Fix `"close
  2. v4.4.12025-12-10 · 2025-12-10 17:21 UTC
    查看更新说明

    Release v4.4.1 (2025-12-10)

    :mag: Overview

    This is a very small patch release we're doing because of a v4.4.0 regression that seemed to impact some applications in various ways.

    We did not include new features to ensure this patch release is as stable as possible.

    Changelog

    Bug fixes

    • Fix v4.4.0 regression where the RxPlayer might base itself on the previous content's position [#1758]
    • Add resilience to DRM fallback when position is not yet known instead of triggering MEDIA_TIME_NOT_FOUND error [#1755]

    Issue when loading several contents without stopping

    The v4.4.0 regression this release fixes, brought with the ability of seeking while the RxPlayer hasn't yet loaded the content, led to an internal RxPlayer issue where for a very brief chunk of time it relied on the position from a potential previous content while running its logic for a new content.

    Yet because we've built the RxPlayer to be resilient, that issue did not have any effect for most applications.

    After a few weeks, one of canal+ application started seeing MEDIA_TIME_NOT_FOUND errors only in multithreaded scenarios and only under a set of time-related conditions. We saw the issue, brought a fix, but thought that it was sufficiently rare, only under the "experimental" MULTI_THREAD feature and had many work-arounds (stopping a content between loads, disabling the MediaKeySession cache etc.) so we thought the impact was limited.

    Yet last week, another application had an "infinite loading" issue, linked to the same root cause.

    Note that in any case, calling stop before calling loadVideo again totally fixes the issue (as our internal position tracking is reset when a content is stopped). Anyway, we decided to release the fix in its own patch release on top of v4.4.0 so it can just work as expected under the more efficient strategy of calling loadVideo without stopping first.

    We also added resilience to our handling of a position that seems not-right to avoid seeing MEDIA_TIME_NOT_FOUND errors even in similar future scenarios, handling minor, recoverable, state discrepancies gracefully instead.

  3. v4.4.02025-09-25 · 2025-09-25 19:16 UTC
    查看更新说明

    Release v4.4.0 (2025-09-25)

    :mag: Overview

    The v4.4.0 is here, with many new features and improvements:

    • new onAudioTracksNotPlayable and onVideoTracksNotPlayable loadVideo options to allow playback even if no audio or video tracks are supported on the current content.

    • A new disableAudioTrack API, to complement the existing disableVideoTrack and disableTextTrack APIs and give you control over all media track types

    • seekTo can now be relied on even when still LOADING / RELOADING, to correct a future playback position.

    • A new getWallClockOffset API to facilitate conversions between the RxPlayer's position and the "wallClockTime" that is generally more useful for live contents.

    • EncryptedMediaError errors, which are those linked to content decryption, now will also communicate context when possible, such as the corresponding key system name and configuration.

    • Add MediaError with the "NO_AUDIO_VIDEO_TRACKS" code for when neither audio nor video is available or when both are disabled

    • "local" Manifests (experimental feature to load contents that are downloaded locally) can now announce forced narrative subtitles tracks, through the new forcedSubtitles property

    • The experimental MediaCapabilitiesProber tool had its API updated to be more flexible (see below)

    • WebVTT embedded in an mp4 segment are now properly handled.

    • Firefox and Chrome recently added PlayReady SL3000 support under most Windows 11 devices. It is now properly handled.

    • Thumbnails (from our new thumbnails API brought in v4.3.0) now have a better caching mechanism.

    • RxPlayer logs have been rewritten to be more easily read and exploited by people relying on the RxPlayer logs for debugging

    • many bug fixes and other improvements

    Changelog

    Features

    • Add onAudioTracksNotPlayable and onVideoTracksNotPlayable loadVideo options to control whether to continue playback is one of those components is not compatible to the current device [#1624]
  4. v3.33.62025-09-25 · 2025-09-25 19:15 UTC
    查看更新说明

    Release v3.33.6 (2025-09-25)

    :mag: Overview

    The v3.33.5 is a "legacy" release (now that the v4 is the current major version) mostly containing some of the bug fixes and improvements initially made for the upcoming v4.4.0 release that should be done just after this one.

    Note that, after a year and a half of support while our v4 was our main focus, it may be our last legacy v3 release, unless a sensible issue is found on it.

    Though we encourage all applications to switch to our v4, we understand that some applications don't have the time for this change. Our v3 will still be available and you can also report issues specifically seen with it, in which case we may still fix the issue depending on the effort for doing so.

    :bookmark_tabs: Changelog

    Bug fixes

    • Subtitles: Fix some subtitle missing on multiple period assets [#1726]
    • DRM: renew the mediaKeySystemAccess on Edge and Firefox when using a Playready keySystem to work-around frequent DRM issues. [#1728]
    • DRM: On Firefox check extensively Playready DRMs support before using them to work-around recent firefox issue with PlayReady integration [#1730]
    • DRM: Fix persistent session loading when Manifest has no key id [#1724]
    • Directfile: set autoplay attribute on directfile contents, to work-around safari-specific issues [#1729]
    • Remove unnecessary duration logs when reaching the end of some VoD contents [1750]
  5. v4.3.02025-04-01 · 2025-04-01 16:06 UTC
    查看更新说明

    Release v4.3.0 (2025-04-01)

    :mag: Overview

    The v4.3.0 is finally here.

    We took some time to release it compared with previous releases due to a lot of other subjects coming our way late last year. We do have worked on a larger amount of features since the last release, yet many of them are thus still in a review phase for now, and we focused on stability and what we thought were the most awaited features for a (normal-sized!) v4.3.0, especially:

    • Handling of DASH thumbnail tracks.

      To minimize the complexity on your side, our thumbnail-related API takes care of every details about thumbnail fetching, caching and rendering, all you'll have to do is providing a timestamp for the wanted thumbnail and the DOM element on which you want to display the corresponding thumbnail.

    • We now automatically handle the ManagedMediaSource API (the MSE variant found on iOS devices), along with its startstreaming / endstreaming events, minimizing battery usage on those devices.

    • We added a new "Representation avoidance" algorithm. The idea is to automatically detect audio and video contents that lead to unexpected decoding issues on the current device and, if detected, to avoid playing them. This follows real issues we had seen on some WebOS and TitanOS devices (respectively mostly LG Smart TVs and mostly Philips Smart TVs).

      For now this new behavior is behind an option - though it might become a default feature in the future as explained below.

    • We added a keySystems[].wantedSessionTypes loadVideo option for very specific DRM-related optimizations. The reasons why applications could need this are somewhat complex and are explained below.

    • We realized that multiple newer devices (at least the Meta Quest 2 and some other embedded devices) had issues decoding Dolby Digital+ only when it was encrypted.

      We had a small issue in our logic detecting codec support in an encrypted context (added in v4.2.0) that made this specific case not handled. Now we should properly avoid any audio or video codec that is unsupported when encrypted.

    • We fixed an issue preventing playback of some contents with h265 video, for now only seen on the Edge browser if specific updates for H265 support were manually installed and if the RxPlayer was running in "multithreading" mode (which seems rare, but it does happen, especially for some techy customers!).

      The root issue may be an Edge Browser bug, but it did reveal an area where we could improve our resilience. We found the components of that issue to be interesting so we added more information on it in this release not!

    • We brought several improvements for Tizen devices, includin

用户点评

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

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

    README 原文

    未翻译

    The RxPlayer is a library implementing a DASH and Microsoft Smooth Streaming media player on a browser, by relying on the HTML5 Media Source Extensions and Encrypted Media extensions browser APIs.

    This library only implements the core, non-UI part of a media player - you provide the interface while it handles the streaming. See our demo page for an example implementation.

    Initially built for Canal+'s complex requirements across diverse devices, it prioritizes configurability and integration flexibility.


    The RxPlayer can be seen as the "engine" providing adaptive streaming capabilities to an application:

    • Beyond DASH and Smooth Streaming support (and HLS on devices with native support like Safari), it handles complex scenarios like multiple DRM keys, fallback mechanisms for undecipherable or undecodable qualities, most subtitle formats and advanced heuristics to keep the playback going.

    • Multi-threaded architecture: core logic can be offloaded to a separate thread, keeping the player from blocking your application and vice-versa.

    • Production-tested across a wide device range: from low-end set-top boxes to high-end computers, with optimizations for constrained environments.

    • Highly configurable with a well-documented API: player behavior can be controlled at a granular level.

    How to use it?

    The fastest way to use the player directly in your code is to add this repository as a dependency.

    You can do it via npm or yarn:

    # when using npm:
    npm install --save rx-player
    
    # or, when using yarn instead:
    yarn add rx-player
    

    You can then directly import and use the RxPlayer in your code:

    import RxPlayer from "rx-player";
    
    const player = new RxPlayer({
      videoElement: document.querySelector("video"),
    });
    
    // play a video
    player.loadVideo({
      url: "http://vm2.dashif.org/livesim-dev/segtimeline_1/testpic_6s/Manifest.mpd",
      transport: "dash",
      autoPlay: true,
    });
    

    We've also written short tutorials to help you familiarize with the RxPlayer API:

    To be able to play with the player without needing to perform any setup we also created multiple live-editable demos:

    Minimal Builds

    To reduce the size of the final code, you might also want to import a minimal version of the player and only import the features you need. This is documented here :

    For example, to play encrypted DASH contents, you could just write:

    import RxPlayer from "rx-player/minimal";
    import { DASH, EME } from "rx-player/features";
    
    // Allow to play encrypted DASH contents
    RxPlayer.addFeatures([DASH, EME]);
    

    API

    We documented the API in every little detail in the API documentation.

    You can also refer to the documentation of our previous versions here

    These documentation pages are automatically generated from the content of the doc/api directory in this repository.

    Demo

    You can view our online Demo, built from our last version, here.

    This demo is a small application written in React demonstrating a simple usage of the player.

    Demo pages for our previous versions are also available here.

    Contribute

    After cloning our repo, you should first install our dependencies via npm:

    npm install
    

    You can then run the list script to see the different scripts provided to test your modifications, run a demo locally etc.:

    npm run list
    

    Details on how to contribute is written in the CONTRIBUTING.md file at the root of this repository.

    Features

    Key features:

    • live and VoD DASH (including low-latency) / Smooth / HLS* / Downloaded contents / MP4* / WebM* contents and more.

    • advanced encryption configuration: multiple keys in a single or separate licenses for a given content, automatic fallbacks on undecipherable contents, persistent licenses, complex MediaKeySystemConfiguration.

    • TTML, WebVTT, SAMI and SRT subtitles.

    • multi-threading support.

    • extensive APIs: audio-only, video track selection, manual garbage collection of segments, Peer-To-Peer integration, quality filtering...

    • adaptive streaming algorithms: both a network-based for quick start-up and buffer-based to provide the best quality possible.

    • complex segment scheduling logic: prioritizing closer media segments while making sure that the bandwidth usage is always optimal and the rebuffering risks always low.

    • heuristics to ensure playback stays smooth, the RxPlayer monitors playback and take actions if the current device has issues while decoding the stream.

    • optional WebAssembly-based MPD parser for DASH contents (for very large Manifests).

    * In "directfile" mode, on compatible browsers