-
Notifications
You must be signed in to change notification settings - Fork 133
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1175 from canalplus/fix/lg-rezap-doesnt-work
Re-create MediaKeys at each loadVideo on WebOS
- Loading branch information
Showing
10 changed files
with
288 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/* eslint-disable @typescript-eslint/no-var-requires */ | ||
/* eslint-disable @typescript-eslint/no-unsafe-call */ | ||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */ | ||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */ | ||
|
||
describe("Compat - canReuseMediaKeys", () => { | ||
afterEach(() => { | ||
jest.resetModules(); | ||
}); | ||
|
||
it("should return true on any browser but WebOS 2021 and 2022", () => { | ||
jest.mock("../browser_detection", () => { | ||
return { __esModule: true as const, | ||
isWebOs2021: false, | ||
isWebOs2022: false }; | ||
}); | ||
const canReuseMediaKeys = | ||
jest.requireActual("../can_reuse_media_keys.ts"); | ||
expect(canReuseMediaKeys.default()).toBe(true); | ||
}); | ||
|
||
it("should return false on WebOs 2021", () => { | ||
jest.mock("../browser_detection", () => { | ||
return { __esModule: true as const, | ||
isWebOs2021: true, | ||
isWebOs2022: false }; | ||
}); | ||
const canReuseMediaKeys = | ||
jest.requireActual("../can_reuse_media_keys.ts"); | ||
expect(canReuseMediaKeys.default()).toBe(false); | ||
}); | ||
|
||
it("should return false on WebOs 2022", () => { | ||
jest.mock("../browser_detection", () => { | ||
return { __esModule: true as const, | ||
isWebOs2021: false, | ||
isWebOs2022: true }; | ||
}); | ||
const canReuseMediaKeys = | ||
jest.requireActual("../can_reuse_media_keys.ts"); | ||
expect(canReuseMediaKeys.default()).toBe(false); | ||
}); | ||
|
||
it("should return false in the improbable case of both WebOs 2021 and 2022", () => { | ||
jest.mock("../browser_detection", () => { | ||
return { __esModule: true as const, | ||
isWebOs2021: true, | ||
isWebOs2022: true }; | ||
}); | ||
const canReuseMediaKeys = | ||
jest.requireActual("../can_reuse_media_keys.ts"); | ||
expect(canReuseMediaKeys.default()).toBe(false); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { | ||
isWebOs2021, | ||
isWebOs2022, | ||
} from "./browser_detection"; | ||
|
||
/** | ||
* Returns `true` if a `MediaKeys` instance (the `Encrypted Media Extension` | ||
* concept) can be reused between contents. | ||
* | ||
* This should usually be the case but we found rare devices where this would | ||
* cause problem: | ||
* - (2022-10-26): WebOS (LG TVs) 2021 and 2022 just rebuffered indefinitely | ||
* when loading a content already-loaded on the HTMLMediaElement. | ||
* | ||
* @returns {boolean} | ||
*/ | ||
export default function canReuseMediaKeys() : boolean { | ||
return !(isWebOs2021 || isWebOs2022); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.