Skip to content

Commit

Permalink
fix Refused to get unsafe header "age" in Chrome
Browse files Browse the repository at this point in the history
  • Loading branch information
radiantmediaplayer committed Mar 26, 2021
1 parent 0299f4a commit 3a81d94
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
3 changes: 1 addition & 2 deletions src/loader/playlist-loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -688,8 +688,7 @@ class PlaylistLoader {

if (
this.checkAgeHeader &&
levelDetails.live &&
this.hls.config.lowLatencyMode
levelDetails.live
) {
const ageHeader = loader.getResponseHeader('age');
levelDetails.ageHeader = ageHeader ? parseFloat(ageHeader) : 0;
Expand Down
8 changes: 2 additions & 6 deletions src/utils/xhr-loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -250,12 +250,8 @@ class XhrLoader implements Loader<LoaderContext> {
}

getResponseHeader(name: string): string | null {
if (this.loader) {
try {
return this.loader.getResponseHeader(name);
} catch (error) {
/* Could not get headers */
}
if (this.loader && this.loader.getAllResponseHeaders().indexOf(name) >= 0) {
return this.loader.getResponseHeader(name);
}
return null;
}
Expand Down

0 comments on commit 3a81d94

Please sign in to comment.