#1943·xgplayer

XhrLoader ignores the transformResponse option

Author: dajiaohuangCreated Aug 22, 2026Updated Aug 22, 2026

您使用的西瓜播放器版本是多少? What version of xgplayer are you using?

xgplayer-streaming-shared 3.0.26, current main at 2c4e5f6c44af7a536b3b8c39c5f4f7567b08078e.

您使用的操作系统和浏览器分别是? What OS and browser are you using?

Windows 11, Node.js 24.14.1. The problem is in the XHR loader path and is also visible from the source independently of a browser implementation.

如何复现问题? How to reproduce the problem?

  1. Create an XhrLoader request with a transformResponse callback that returns a modified response object.
  2. Complete the mocked XMLHttpRequest successfully.
  3. Inspect the resolved response or the response passed to onProgress.

The shared network config exposes transformResponse, and FetchLoader invokes the request callback. XhrLoader declares and later reads this._transformResponse in its load-complete path, but load() never assigns req.transformResponse to that field.

您期望的播放器正常行为是? What did you expect to happen?

The transformResponse callback should run for XHR responses, and its returned response should be exposed consistently with FetchLoader.

实际播放器的表现是? What actually happened?

The callback is never called and the original XHR response metadata is returned unchanged. This makes the documented option silently depend on loader selection; applications using the XHR fallback or explicitly selecting XHR cannot normalize response metadata as configured.

可填写您所在的公司和相关产品业务,方便我们提供更好的技术支持 You can write your company and product which uses xgplayer, for helping us provide better technical support.

Independent maintenance audit; no company/product context.