Source: lib/offline/indexeddb/v5_storage_cell.js

  1. /*! @license
  2. * Shaka Player
  3. * Copyright 2016 Google LLC
  4. * SPDX-License-Identifier: Apache-2.0
  5. */
  6. goog.provide('shaka.offline.indexeddb.V5StorageCell');
  7. goog.require('shaka.offline.indexeddb.BaseStorageCell');
  8. /**
  9. * The V5StorageCell is for all stores that follow the shaka.externs V5 offline
  10. * types introduced in v3.0.
  11. *
  12. * @implements {shaka.extern.StorageCell}
  13. */
  14. shaka.offline.indexeddb.V5StorageCell = class
  15. extends shaka.offline.indexeddb.BaseStorageCell {
  16. /** @override */
  17. hasFixedKeySpace() {
  18. // This makes the cell read-write.
  19. return false;
  20. }
  21. /** @override */
  22. addSegments(segments) {
  23. return this.add(this.segmentStore_, segments);
  24. }
  25. /** @override */
  26. addManifests(manifests) {
  27. return this.add(this.manifestStore_, manifests);
  28. }
  29. /** @override */
  30. updateManifest(key, manifest) {
  31. return this.updateManifestImplementation(key, manifest);
  32. }
  33. /** @override */
  34. convertManifest(old) {
  35. // JSON serialization turns Infinity into null, so turn it back now.
  36. if (old.expiration == null) {
  37. old.expiration = Infinity;
  38. }
  39. return Promise.resolve(/** @type {shaka.extern.ManifestDB} */(old));
  40. }
  41. };