Skip to content

Commit 8235748

Browse files
committed
Replace buggy Promise polyfill
A bug in our Promise polyfill caused issues with the recently-added AbortableOperation class on IE11. Since external polyfills for this are smaller, it is easier to remove ours in favor of a third-party polyfill. Applications that wish to support IE11 must now load this additional polyfill. We are using the "es6-promise-polyfill" module from npm, but any compliant polyfill should suffice. One feature our own polyfill offered was the ability to flush all Promises, which allowed us to write synchronous unit tests that simulated async processes. To get this ability back, we are now using the "promise-mock" module in our tests. Getting "promise-mock" to load correctly involved switching from "requirejs" to "cajon", which builds on requirejs and supports AMD modules more directly. Closes #1260 Change-Id: I5de48e88a910736ae5c1897a7a509bc5641acb70
1 parent abf9f5e commit 8235748

File tree

20 files changed

+193
-1351
lines changed

20 files changed

+193
-1351
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,12 @@ NOTES:
4040
- ¹: Only the latest stable version is tested and supported. Older releases may still be usable, and we will accept pull requests for them, but they will not be officially tested or supported.
4141
- ²: Latest stable Chromecast firmware is tested. Both sender and receiver can be implemented with Shaka Player.
4242
- ³: Tizen 2017 model is actively tested and supported by the Shaka Player team. Tizen 2016 model is community-supported and untested by us.
43-
- ⁴: IE 11 offers PlayReady support on Windows 8.1 and Windows 10 only. IE 11 can play clear content on Windows 8.0. IE 11 does not support adaptive playback on Windows 7 and under.
43+
- ⁴: IE 11 offers PlayReady support on Windows 8.1 and Windows 10 only. IE 11 can play clear content on Windows 8.0. IE 11 does not support adaptive playback on Windows 7 and under. A separate [Promise polyfill][] is required for IE 11.
4444
- ⁵: These are expected to work, but are not actively tested by the Shaka Player team.
4545
- ⁶: All iOS browers use the same HTML engine (Apple WebKit) and are not supported because they lack MediaSource support. For more information, see: https://github.com/google/shaka-player/issues/997
4646

47+
[Promise polyfill]: https://github.com/lahmatiy/es6-promise-polyfill
48+
4749

4850
## Manifest format support matrix
4951

build/types/polyfill

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
+../../lib/polyfill/patchedmediakeys_ms.js
1010
+../../lib/polyfill/patchedmediakeys_nop.js
1111
+../../lib/polyfill/patchedmediakeys_webkit.js
12-
+../../lib/polyfill/promise.js
1312
+../../lib/polyfill/video_play_promise.js
1413
+../../lib/polyfill/videoplaybackquality.js
1514
+../../lib/polyfill/vttcue.js

demo/index.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,10 @@
3636
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
3737

3838
<script defer src="//www.gstatic.com/cv/js/sender/v1/cast_sender.js"></script>
39+
<!-- transmuxing support is enabled by including this: -->
3940
<script defer src="../node_modules/mux.js/dist/mux.js"></script>
41+
<!-- IE11 support is enabled by including this: -->
42+
<script defer src="../node_modules/es6-promise-polyfill/promise.min.js"></script>
4043

4144
<script>
4245
COMPILED_JS = [

docs/tutorials/faq.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,18 @@ existing http plugin for `file://` requests:
136136
shaka.net.NetworkingEngine.registerScheme('file', shaka.net.HttpPlugin);
137137
```
138138

139+
<hr>
140+
141+
**Q:** Why doesn't my app work in IE 11?
142+
143+
**A:** IE 11 doesn't have native Promise support. Starting with v2.4,
144+
applications are required to load their own Promise polyfill for IE support.
145+
We no longer maintain and ship our own polyfill for this. We recommend
146+
es6-promise-polyfill.
147+
148+
Polyfill source: https://github.com/lahmatiy/es6-promise-polyfill
149+
Polyfill on NPM: https://www.npmjs.com/package/es6-promise-polyfill
150+
139151

140152
[386]: https://github.com/google/shaka-player/issues/386#issuecomment-227898001
141153
[489]: https://github.com/google/shaka-player/issues/489#issuecomment-240466224

docs/tutorials/plugins.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ __Polyfills__
6969
{@linksource shaka.polyfill.VideoPlaybackQuality}
7070
- prefixed EME implementations for IE 11 and very old versions of embedded
7171
Chrome/Chromium: {@linksource shaka.polyfill.MediaKeys}
72-
- Promise implementation for IE 11: {@linksource shaka.polyfill.Promise}
7372
- variants of VTTCue and TextTrackCue constructors:
7473
{@linksource shaka.polyfill.VTTCue}
7574

karma.conf.js

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -82,17 +82,14 @@ module.exports = function(config) {
8282
'dist/deps.js',
8383
'shaka-player.uncompiled.js',
8484

85-
// sprintf module next
86-
// Since we don't use require to load the sprintf module, this must be
87-
// loaded before requirejs is loaded! Otherwise, it tries to use
88-
// requirejs instead of loading directly into the window.
89-
'node_modules/sprintf-js/src/sprintf.js',
85+
// Promise polyfill for IE11 and some older TVs
86+
'node_modules/es6-promise-polyfill/promise.js',
9087

9188
// muxjs module next
9289
'node_modules/mux.js/dist/mux.js',
9390

94-
// requirejs module next
95-
'node_modules/requirejs/require.js',
91+
// cajon module (an AMD variant of requirejs) next
92+
'node_modules/cajon/cajon.js',
9693

9794
// bootstrapping for the test suite
9895
'test/test/boot.js',
@@ -113,6 +110,7 @@ module.exports = function(config) {
113110
{pattern: 'third_party/closure/goog/**/*.js', included: false},
114111
{pattern: 'test/test/assets/*', included: false},
115112
{pattern: 'dist/shaka-player.compiled.js', included: false},
113+
{pattern: 'node_modules/**/*.js', included: false},
116114
],
117115

118116
// NOTE: Do not use proxies at all! They cannot be used with the --hostname

0 commit comments

Comments
 (0)