hls.js 获取ts片段数据后处理,截取不要的数据
(function (Hls, offset) {
        var load = Hls.DefaultConfig.loader.prototype.load;
        Hls.DefaultConfig.loader.prototype.load = function (context, config, callbacks) {
            if (context.type == null) {
                var onSuccess = callbacks.onSuccess;
                callbacks.onSuccess = function (response, stats, context) {
                    response.data = response.data.slice(offset);
                    // console.log( response.data,context.type)
                    return onSuccess.call(this, response, stats, context);
                };
            }
            return load.call(this, context, config, callbacks);
        }
    })(Hls, 0); //截取不要的数据


文档:

https://github.com/video-dev/hls.js/blob/master/docs/API.md#loader

Preview Image