Shouldn’t the .manifest URL creation be optimized?
Currently, this is the line that add the URL to get the .manifest file:
var manifestURL = this._currentSceneUrl + ".manifest";
That code leads to a problem when the asset is behind a protected API, or that some parameters need to be added to the requested (Azure Storage, Google Buckets, etc…).
I’ve made this simple playground just to illustrate:
This is the URL from the asset:
https://playground.babylonjs.com/scenes/skull.babylon?test=1
II’ve added a query string that makes no difference to the request. Though, it concerns the URL trying to get the .manifest file:
https://playground.babylonjs.com/scenes/skull.babylon?test=1.manifest&1613477087021
In any case, it should be:
https://playground.babylonjs.com/scenes/skull.babylon.manifest?test=1&1613477087021
A simple solution would be
const manifestURL = new URL(this._currentSceneUrl)
manifestURL.pathname += '.manifest';
var xhr = new WebRequest();
if (navigator.onLine) {
// Adding a timestamp to by-pass browsers' cache
timeStampUsed = true;
manifestURL.search += (manifestURL.match(/\?/) == null ? "?" : "&") + Date.now();
}
For the timestamp, another approach would be leveraging the use of URLSearchParams:
url.searchParams.append('t', Date.now()); // result t={timestamp}
Result:
https://playground.babylonjs.com/scenes/skull.babylon.manifest?test=1&t=1613477087021
Moreover, I am aware that a custom cache could be created on my own through IOfflineProvider. Though, I think that is a simple solution.