Skip to content

Commit

Permalink
fix: Handle non existing navigator.platform string (#6517) (#6518)
Browse files Browse the repository at this point in the history
This fix will make it possible to use v4.8 in Cobalt browser. The
problem is that navigator.platform doesn't exist in Cobalt browser.

Fixes #6517

---------

Co-authored-by: Álvaro Velad Galván <ladvan91@hotmail.com>
  • Loading branch information
MichaelSweden and avelad authored Apr 30, 2024
1 parent 2f5062a commit f337e06
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/util/platform.js
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,9 @@ shaka.util.Platform = class {
return navigator.userAgentData.platform.toLowerCase() == 'macos';
}
// Fall back to the old API, with less strict matching.
if (!navigator.platform) {
return false;
}
return navigator.platform.toLowerCase().includes('mac');
}

Expand All @@ -430,6 +433,9 @@ shaka.util.Platform = class {
return navigator.userAgentData.platform.toLowerCase() == 'windows';
}
// Fall back to the old API, with less strict matching.
if (!navigator.platform) {
return false;
}
return navigator.platform.toLowerCase().includes('windows');
}

Expand Down

0 comments on commit f337e06

Please sign in to comment.