Skip to content

Commit 9314a79

Browse files
aveladjoeyparrish
authored andcommitted
fix: Throw preload destroyed error when re-using same preloadManager (#8046)
Related to #8042
1 parent 62210fc commit 9314a79

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

lib/player.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1509,6 +1509,12 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
15091509
let preloadManager = null;
15101510
let assetUri = '';
15111511
if (assetUriOrPreloader instanceof shaka.media.PreloadManager) {
1512+
if (assetUriOrPreloader.isDestroyed()) {
1513+
throw new shaka.util.Error(
1514+
shaka.util.Error.Severity.CRITICAL,
1515+
shaka.util.Error.Category.PLAYER,
1516+
shaka.util.Error.Code.PRELOAD_DESTROYED);
1517+
}
15121518
preloadManager = assetUriOrPreloader;
15131519
assetUri = preloadManager.getAssetUri() || '';
15141520
} else {

lib/util/error.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -960,6 +960,12 @@ shaka.util.Error.Code = {
960960
*/
961961
'SRC_EQUALS_PRELOAD_NOT_SUPPORTED': 7005,
962962

963+
/**
964+
* The operation failed because the preload has been destroyed. This can
965+
* happen by reusing the same preload in multiple load calls.
966+
*/
967+
'PRELOAD_DESTROYED': 7006,
968+
963969
/**
964970
* The Cast API is unavailable. This may be because of one of the following:
965971
* 1. The browser may not have Cast support

0 commit comments

Comments
 (0)