shaka-player 3.3.8 → 3.3.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/.github/workflows/build-and-test.yaml +67 -15
  2. package/.github/workflows/compute-incremental-coverage.py +251 -0
  3. package/.github/workflows/report-incremental-coverage.yaml +39 -0
  4. package/.github/workflows/selenium-lab-tests.yaml +44 -1
  5. package/AUTHORS +1 -0
  6. package/CHANGELOG.md +15 -0
  7. package/CONTRIBUTORS +1 -0
  8. package/dist/controls.css +1 -1
  9. package/dist/locales.js +32 -32
  10. package/dist/shaka-player.compiled.d.ts +1 -1
  11. package/dist/shaka-player.compiled.debug.d.ts +1 -1
  12. package/dist/shaka-player.compiled.debug.externs.js +1 -1
  13. package/dist/shaka-player.compiled.debug.js +85 -79
  14. package/dist/shaka-player.compiled.debug.map +3 -3
  15. package/dist/shaka-player.compiled.externs.js +1 -1
  16. package/dist/shaka-player.compiled.js +317 -313
  17. package/dist/shaka-player.compiled.map +3 -3
  18. package/dist/shaka-player.ui.d.ts +1 -1
  19. package/dist/shaka-player.ui.debug.d.ts +1 -1
  20. package/dist/shaka-player.ui.debug.externs.js +1 -1
  21. package/dist/shaka-player.ui.debug.js +100 -94
  22. package/dist/shaka-player.ui.debug.map +3 -3
  23. package/dist/shaka-player.ui.externs.js +1 -1
  24. package/dist/shaka-player.ui.js +492 -489
  25. package/dist/shaka-player.ui.map +3 -3
  26. package/karma.conf.js +3 -11
  27. package/lib/ads/client_side_ad_manager.js +1 -1
  28. package/lib/media/drm_engine.js +1 -1
  29. package/lib/media/streaming_engine.js +1 -0
  30. package/lib/player.js +1 -6
  31. package/lib/polyfill/media_capabilities.js +2 -0
  32. package/lib/text/cue.js +0 -5
  33. package/lib/text/simple_text_displayer.js +21 -9
  34. package/lib/text/ui_text_displayer.js +83 -19
  35. package/lib/util/buffer_utils.js +3 -0
  36. package/lib/util/object_utils.js +1 -0
  37. package/lib/util/stream_utils.js +23 -3
  38. package/lib/util/string_utils.js +63 -16
  39. package/package.json +5 -2
  40. package/test/text/simple_text_displayer_unit.js +27 -0
  41. package/test/text/ui_text_displayer_unit.js +65 -0
  42. package/test/util/string_utils_unit.js +46 -8
  43. package/ui/text_selection.js +2 -2
@@ -5,6 +5,29 @@
5
5
  */
6
6
 
7
7
  describe('StringUtils', () => {
8
+ describe('with TextDecoder', () => {
9
+ if (window.TextDecoder) {
10
+ defineStringUtilTests();
11
+ }
12
+ });
13
+
14
+ describe('without TextDecoder', () => {
15
+ let originalTextDecoder;
16
+
17
+ beforeAll(() => {
18
+ originalTextDecoder = window.TextDecoder;
19
+ window['TextDecoder'] = null;
20
+ });
21
+
22
+ afterAll(() => {
23
+ window.TextDecoder = originalTextDecoder;
24
+ });
25
+
26
+ defineStringUtilTests();
27
+ });
28
+ });
29
+
30
+ function defineStringUtilTests() {
8
31
  const StringUtils = shaka.util.StringUtils;
9
32
 
10
33
  it('parses fromUTF8', () => {
@@ -16,19 +39,34 @@ describe('StringUtils', () => {
16
39
  });
17
40
 
18
41
  it('won\'t break if given cut-off UTF8 character', () => {
19
- // This array contains the first half of a 2-byte UTF8 character, stranded
20
- // at the very end of the string.
21
- const arr1 = [0x53, 0x61, 0x6e, 0x20, 0x4a, 0x6f, 0x73, 0x81];
42
+ const arr1 = [0x53, 0x61, 0x6e, 0x20, 0x4a, 0x6f, 0x73, 0xc3, 0xa9];
22
43
  expect(StringUtils.fromUTF8(new Uint8Array(arr1)))
44
+ .toBe('San Jos\u00E9');
45
+
46
+ // This array contains the first half of a 2-byte UTF8 character
47
+ // (0xc3 0xa9 = é). The half-character is stranded at the very end of the
48
+ // string.
49
+ const arr = [0x53, 0x61, 0x6e, 0x20, 0x4a, 0x6f, 0x73, 0xc3];
50
+ expect(StringUtils.fromUTF8(new Uint8Array(arr)))
23
51
  .toBe('San Jos\uFFFD');
52
+ });
24
53
 
25
- // For reasons I don't know, it seems like 0xE9 cannot be the start of a
26
- // UTF8 character. Perhaps it is a reserved number?
27
- const arr2 = [0x4a, 0x6f, 0x73, 0xE9, 0x33, 0x33, 0x20, 0x53, 0x61, 0x6e];
28
- expect(StringUtils.fromUTF8(new Uint8Array(arr2)))
54
+ it('won\'t break if given an invalid UTF-8 sequence', () => {
55
+ // 0xe9 0x33 0x33 is an invalid UTF-8 sequence.
56
+ const arr = [0x4a, 0x6f, 0x73, 0xE9, 0x33, 0x33, 0x20, 0x53, 0x61, 0x6e];
57
+ expect(StringUtils.fromUTF8(new Uint8Array(arr)))
29
58
  .toBe('Jos\uFFFD33 San');
30
59
  });
31
60
 
61
+ it('can handle an 8-byte character', () => {
62
+ // This is the UTF-8 encoding of the US flag emoji.
63
+ // It decodes into two Unicode codepoints, which becomes 4 JavaScript
64
+ // UTF-16 characters.
65
+ const arr = [0xf0, 0x9f, 0x87, 0xba, 0xf0, 0x9f, 0x87, 0xb8];
66
+ expect(StringUtils.fromUTF8(new Uint8Array(arr)))
67
+ .toBe('\uD83C\uDDFA\uD83C\uDDF8');
68
+ });
69
+
32
70
  it('strips the BOM in fromUTF8', () => {
33
71
  // This is 4 Unicode characters, the last will be split into a surrogate
34
72
  // pair.
@@ -125,4 +163,4 @@ describe('StringUtils', () => {
125
163
  expect(StringUtils.fromUTF16(buffer, true).length)
126
164
  .toBe(buffer.byteLength / 2);
127
165
  });
128
- });
166
+ }
@@ -111,11 +111,11 @@ shaka.ui.TextSelection = class extends shaka.ui.SettingsMenu {
111
111
  onCaptionStateChange_() {
112
112
  if (this.player.isTextTrackVisible()) {
113
113
  this.icon.textContent =
114
- shaka.ui.Enums.MaterialDesignIcons.CLOSED_CAPTIONS_OFF;
114
+ shaka.ui.Enums.MaterialDesignIcons.CLOSED_CAPTIONS;
115
115
  this.button.ariaPressed = 'true';
116
116
  } else {
117
117
  this.icon.textContent =
118
- shaka.ui.Enums.MaterialDesignIcons.CLOSED_CAPTIONS;
118
+ shaka.ui.Enums.MaterialDesignIcons.CLOSED_CAPTIONS_OFF;
119
119
  this.button.ariaPressed = 'false';
120
120
  }
121
121