shaka-player-embedded icon indicating copy to clipboard operation
shaka-player-embedded copied to clipboard

Get content size before starting download

Open OmarPedraza opened this issue 5 years ago • 1 comments

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?

OmarPedraza avatar Oct 08 '20 12:10 OmarPedraza

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.

TheModMaker avatar Oct 12 '20 18:10 TheModMaker