fix: VTT Cue Parsing On PlayStation 4 (#4340)

Need to exclude PlayStation 4 from TextDecoder usage, because even if TextDecoder is defined, VTT cues are not properly parsed on that platform.

Closes #4321
This commit is contained in:
Agajan J
2022-07-11 13:53:11 -07:00
committed by GitHub
parent 5b18069430
commit b5da41ed80
2 changed files with 4 additions and 2 deletions
+3 -2
View File
@@ -11,6 +11,7 @@ goog.require('shaka.log');
goog.require('shaka.util.BufferUtils');
goog.require('shaka.util.Error');
goog.require('shaka.util.Lazy');
goog.require('shaka.util.Platform');
/**
@@ -36,7 +37,7 @@ shaka.util.StringUtils = class {
if (uint8[0] == 0xef && uint8[1] == 0xbb && uint8[2] == 0xbf) {
uint8 = uint8.subarray(3);
}
if (window.TextDecoder) {
if (window.TextDecoder && !shaka.util.Platform.isPS4()) {
// Use the TextDecoder interface to decode the text. This has the
// advantage compared to the previously-standard decodeUriComponent that
// it will continue parsing even if it finds an invalid UTF8 character,
@@ -160,7 +161,7 @@ shaka.util.StringUtils = class {
* @export
*/
static toUTF8(str) {
if (window.TextEncoder) {
if (window.TextEncoder && !shaka.util.Platform.isPS4()) {
const utf8Encoder = new TextEncoder();
return shaka.util.BufferUtils.toArrayBuffer(utf8Encoder.encode(str));
} else {