Use AbortableOperation in networking

This uses AbortableOperation in all networking, from the scheme
plugins all the way to the request interface.

This also updates all default scheme plugins, docs, and sample code.

Backward compatibility is provided for scheme plugins and the
request API in NetworkingEngine.  This compatibility will be
removed in v2.5.

Two cancelation-related tests have been disabled in
player_integration until the new abort interface has been adopted
in the manifest parsers.

Issue #829

Change-Id: I91c8e6efe97798d111e8ddca5655cddc1f6bcbf3
This commit is contained in:
Joey Parrish
2018-01-22 19:03:23 -08:00
parent e5afb35169
commit 2f55d2a3bd
31 changed files with 659 additions and 456 deletions
+2 -2
View File
@@ -219,8 +219,8 @@ Now change the request filter:
method: 'POST',
};
var requestType = shaka.net.NetworkingEngine.RequestType.APP;
return player.getNetworkingEngine().request(requestType, authRequest).then(
function(response) {
return player.getNetworkingEngine().request(requestType, authRequest)
.promise.then(function(response) {
// This endpoint responds with the value we should use in the header.
authToken = shaka.util.StringUtils.fromUTF8(response.data);
console.log('Received auth token', authToken);
+1 -1
View File
@@ -27,7 +27,7 @@ MyManifestParser.prototype.start = function(uri, playerInterface) {
method: 'GET',
retryParameters: this.config_.retryParameters
};
return playerInterface.networkingEngine.request(type, request)
return playerInterface.networkingEngine.request(type, request).promise
.then(function(response) {
return this.loadManifest_(response.data);
});
+6 -5
View File
@@ -366,11 +366,12 @@ MyManifestParser.prototype.start =
var type = shaka.net.NetworkingEngine.RequestType.MANIFEST;
var request = shaka.net.NetworkingEngine.makeRequest(
[uri], this.config_.retryParameters);
return this.networkingEngine_.request(type, request).then(function(response) {
this.manifest_ = this.parseInternal_(response.data);
this.updateInterval_ = setInterval(this.updateManifest_.bind(this), 5000);
return this.manifest_;
});
return this.networkingEngine_.request(type, request).promise
.then(function(response) {
this.manifest_ = this.parseInternal_(response.data);
this.updateInterval_ = setInterval(this.updateManifest_.bind(this), 5000);
return this.manifest_;
});
};
/** @return {!Promise} */