Closed ignazio-bovo closed 6 months ago
scope: detail how videos are fetched in atlas in the video player page view, that is once I am on the home page and then I click on any of the video suggested
1.GetFullVideo
query is called. The fragment contains several fields among which a media.resolvedUrls
.
userLocation
available in the Application tab > Local Storage > gleev.xyz
on developer tools of most browsersresolvedUrls
are passed to the VideoComponents
and eventually passed to useGetAssetUrl
. The part where the logic select the right distributor node + asset for the react component is where the resolvedUrl
variable is initialized via useSingleAssetUrl
useSingleAssetUrl
runs orderly through every distribution url and for each construct a testAssetDownload
promise. Subsequently select the first url that resolves that promise before a specific timeout
. If no url is able to satisfy the timeout time constraint then it select the first url that resolve the promise constructed previously. the testAssetDownload
when the asset is of type video if probes the url by sending a HEAD
request and resolving when the first byte is receivedtimeOut
. If none of the url is able to provide a time to first byte lower than the timeOut
value then the distribution node that is able to provide the lowest sampled time to first bytescope: detail how video thumbnails are fetched in atlas
Since for each asset a sequence of resolvedUrl
is similarly fetched, the process for image asset is identical in terms of DN urls choice
@ignazio-bovo I think we still need to look into those timeouts logic. I have seen problematic behaviour on slow connections where Atlas kept switching provider, not giving any single URL enough time to load. This most likely resulted in worse UX if it just waited a bit longer for the first URL to load
From the source code if none of the url is resolved within a specified timeout, then the first url to resolve is used The timeout value default value is here
Yeah but from my experience on bad connection, the logic could be improved. If let's say video needs 500ms to start playing, but timeout gets set at 400ms, then Atlas will try X URLs for 400ms resulting in X * 400ms
wait for the user, but if it just waited a bit longer, it would be only 500ms.
SSIA. It's not clear yet how exactly Atlas identifies distributor nodes, especially when geolocation data is missing