shaka-player-embedded
shaka-player-embedded copied to clipboard
Get content size before starting download
Hi there,
Another enhancement for ShakaPlayerStorageClient would be returning content size before starting the download for checking if device has enough space for it.
Are you already checking that internally?
I've tried to get the size by using this code but it returns different values during the whole download (tending to be more stable at the end).
extension DownloadManager: ShakaPlayerStorageClient {
func onStorageProgress(_ progress: Double, with content: ShakaStoredContent) {
print("size: \(content.size / progress)")
}
}
Do you have any other idea before doing HEAD requests for getting file sizes?
We don't have anything now; we just download it and hope it fits. This will be non-trivial to add since it will require big changes to Shaka Player. I've filed google/shaka-player#2900 to add the feature on that side. We can use byte ranges in the manifest to avoid HEAD requests; but if the manifest says whole segments, we'll need to make a HEAD request.