mirror of
https://github.com/shaka-project/shaka-player.git
synced 2026-06-26 17:46:26 +03:00
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:
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
|
||||
@@ -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} */
|
||||
|
||||
Reference in New Issue
Block a user