-
Notifications
You must be signed in to change notification settings - Fork 7
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 #9 from vitalygashkov/next
Added switch for request interception, fixed active client state with single imported client, added method to convert from base64 to hex
- Loading branch information
Showing
16 changed files
with
295 additions
and
163 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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,34 @@ | ||
declare global { | ||
interface Window { | ||
MPD_LIST: Map<string, string>; | ||
} | ||
} | ||
|
||
export default defineUnlistedScript(() => { | ||
window.MPD_LIST = new Map(); | ||
|
||
const parsePssh = (text: string, url: string) => { | ||
const parser = new DOMParser(); | ||
const mpd = parser.parseFromString(text, 'text/xml'); | ||
const contentProtectionList = mpd.querySelectorAll( | ||
'ContentProtection[schemeIdUri="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"]', | ||
); | ||
for (const contentProtection of contentProtectionList) { | ||
const children = Array.from(contentProtection.children); | ||
for (const child of children) { | ||
if (child.nodeName === 'cenc:pssh') { | ||
const pssh = child.textContent; | ||
if (!pssh) continue; | ||
window.MPD_LIST.set(pssh, url); | ||
} | ||
} | ||
} | ||
}; | ||
|
||
window.addEventListener('message', (event) => { | ||
const isResponse = event.data.method === 'response'; | ||
if (!isResponse) return; | ||
const { url, headers, text } = event.data.params; | ||
parsePssh(text, url); | ||
}); | ||
}); |
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.