diff --git a/src/content-steering-controller.js b/src/content-steering-controller.js index afffc98f5..fab61160b 100644 --- a/src/content-steering-controller.js +++ b/src/content-steering-controller.js @@ -171,7 +171,8 @@ export default class ContentSteeringController extends videojs.EventTarget { } this.request_ = this.xhr_({ - uri + uri, + requestType: 'content-steering-manifest' }, (error, errorInfo) => { if (error) { // If the client receives HTTP 410 Gone in response to a manifest request, diff --git a/src/dash-playlist-loader.js b/src/dash-playlist-loader.js index 907a518e3..53f71d4c2 100644 --- a/src/dash-playlist-loader.js +++ b/src/dash-playlist-loader.js @@ -636,7 +636,8 @@ export default class DashPlaylistLoader extends EventTarget { requestMain_(cb) { this.request = this.vhs_.xhr({ uri: this.mainPlaylistLoader_.srcUrl, - withCredentials: this.withCredentials + withCredentials: this.withCredentials, + requestType: 'dash-manifest' }, (error, req) => { if (this.requestErrored_(error, req)) { if (this.state === 'HAVE_NOTHING') { @@ -695,7 +696,8 @@ export default class DashPlaylistLoader extends EventTarget { this.request = this.vhs_.xhr({ uri: resolveUrl(this.mainPlaylistLoader_.srcUrl, utcTiming.value), method: utcTiming.method, - withCredentials: this.withCredentials + withCredentials: this.withCredentials, + requestType: 'dash-clock-sync' }, (error, req) => { // disposed if (!this.request) { diff --git a/src/media-segment-request.js b/src/media-segment-request.js index fabced1cb..2c422b535 100644 --- a/src/media-segment-request.js +++ b/src/media-segment-request.js @@ -988,7 +988,8 @@ export const mediaSegmentRequest = ({ } const keyRequestOptions = merge(xhrOptions, { uri: segment.key.resolvedUri, - responseType: 'arraybuffer' + responseType: 'arraybuffer', + requestType: 'segment-key' }); const keyRequestCallback = handleKeyResponse(segment, objects, finishProcessingFn); const keyXhr = xhr(keyRequestOptions, keyRequestCallback); @@ -1003,7 +1004,8 @@ export const mediaSegmentRequest = ({ if (differentMapKey) { const mapKeyRequestOptions = merge(xhrOptions, { uri: segment.map.key.resolvedUri, - responseType: 'arraybuffer' + responseType: 'arraybuffer', + requestType: 'segment-key' }); const mapKeyRequestCallback = handleKeyResponse(segment, [segment.map.key], finishProcessingFn); const mapKeyXhr = xhr(mapKeyRequestOptions, mapKeyRequestCallback); @@ -1013,7 +1015,8 @@ export const mediaSegmentRequest = ({ const initSegmentOptions = merge(xhrOptions, { uri: segment.map.resolvedUri, responseType: 'arraybuffer', - headers: segmentXhrHeaders(segment.map) + headers: segmentXhrHeaders(segment.map), + requestType: 'segment-media-initialization' }); const initSegmentRequestCallback = handleInitSegmentResponse({segment, finishProcessingFn}); const initSegmentXhr = xhr(initSegmentOptions, initSegmentRequestCallback); @@ -1024,7 +1027,8 @@ export const mediaSegmentRequest = ({ const segmentRequestOptions = merge(xhrOptions, { uri: segment.part && segment.part.resolvedUri || segment.resolvedUri, responseType: 'arraybuffer', - headers: segmentXhrHeaders(segment) + headers: segmentXhrHeaders(segment), + requestType: 'segment' }); const segmentRequestCallback = handleSegmentResponse({ diff --git a/src/playlist-loader.js b/src/playlist-loader.js index 92f5b4e86..ed6da6891 100644 --- a/src/playlist-loader.js +++ b/src/playlist-loader.js @@ -446,7 +446,8 @@ export default class PlaylistLoader extends EventTarget { this.request = this.vhs_.xhr({ uri, - withCredentials: this.withCredentials + withCredentials: this.withCredentials, + requestType: 'hls-playlist' }, (error, req) => { // disposed if (!this.request) { @@ -689,7 +690,8 @@ export default class PlaylistLoader extends EventTarget { this.request = this.vhs_.xhr({ uri: playlist.resolvedUri, - withCredentials: this.withCredentials + withCredentials: this.withCredentials, + requestType: 'hls-playlist' }, (error, req) => { // disposed if (!this.request) { @@ -835,7 +837,8 @@ export default class PlaylistLoader extends EventTarget { // request the specified URL this.request = this.vhs_.xhr({ uri: this.src, - withCredentials: this.withCredentials + withCredentials: this.withCredentials, + requestType: 'hls-playlist' }, (error, req) => { // disposed if (!this.request) { diff --git a/src/xhr.js b/src/xhr.js index 7d3c213d8..aebe6fdad 100644 --- a/src/xhr.js +++ b/src/xhr.js @@ -13,10 +13,6 @@ import videojs from 'video.js'; import window from 'global/window'; import {merge} from './util/vjs-compat'; -const { - xhr: videojsXHR -} = videojs; - const callbackWrapper = function(request, error, response, callback) { const reqResponse = request.responseType === 'arraybuffer' ? request.response : request.responseText; @@ -115,7 +111,7 @@ const xhrFactory = function() { // Use the standard videojs.xhr() method unless `videojs.Vhs.xhr` has been overriden // TODO: switch back to videojs.Vhs.xhr.name === 'XhrFunction' when we drop IE11 - const xhrMethod = videojs.Vhs.xhr.original === true ? videojsXHR : videojs.Vhs.xhr; + const xhrMethod = videojs.Vhs.xhr.original === true ? videojs.xhr : videojs.Vhs.xhr; // call all registered onRequest hooks, assign new options. const beforeRequestOptions = callAllRequestHooks(_requestCallbackSet, options);