Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

core-js Promise polyfill not working with Shaka Player on IE11 #1062

Closed
bengeorge opened this issue Oct 11, 2017 · 9 comments
Closed

core-js Promise polyfill not working with Shaka Player on IE11 #1062

bengeorge opened this issue Oct 11, 2017 · 9 comments
Assignees
Labels
status: archived Archived and locked; will not be updated type: external An issue with an external dependency; not our issue; sometimes kept open for tracking

Comments

@bengeorge
Copy link

Have you read the FAQ and checked for duplicate issues: Yes

What version of Shaka Player are you using: 2.2.2

Can you reproduce the issue with our latest release version: Yes 2.2.2

Can you reproduce the issue with the latest code from master: Not tried.

Are you using the demo app or your own custom app: Own app

If custom app, can you reproduce the issue using our demo app: No, not sure how I could.

What browser and OS are you using: IE11 (works in Edge, Chrome), Windows 10

What are the manifest and license server URIs:
(you can send the URIs to [email protected] instead, but please use GitHub and the template for the rest)

What did you do?
Added promise polyfil ([email protected]) and use Shaka. eg:

import { shaka } from 'shaka-player/dist/shaka-player.compiled.debug';
import 'core-js/modules/es6.promise';

What did you expect to happen?
Playback to work.

What actually happened?
Get errors and no playback is possible.

IndexedDB.install
InputEvent.install
Patching input event support on IE.
mathRound.install
polyfill Math.round
MediaKeys.install
Using ms-prefixed EME v20140218
PatchedMediaKeysMs.install
MediaSource.install
Using native MSE as-is.
Using native Promises.
VideoPlayPromise.install
Using VTTCue polyfill from 3 argument TextTrackCue.
Unload latency: 0.041
Wrong error type!
load() failed: TypeError: [object Promise] is not iterable!
   "load() failed:"
   {
      [functions]: ,
      __proto__: { },
      message: "[object Promise] is not iterable!",
      name: "TypeError",
      stack: "TypeError: [object Promise] is not iterable!
   at module.exports (eval code:14:34)
   at Anonymous function (eval code:271:7)
   at perform (eval code:61:5)
   at all (eval code:267:5)
   at shaka.dash.MpdUtils.processXlinks (eval code:288:62)
   at shaka.dash.DashParser.prototype.parseManifest_ (eval code:389:214)
   at Anonymous function (eval code:388:374)
   at run (eval code:89:13)
   at Anonymous function (eval code:102:28)
   at flush (eval code:18:9)",
      Symbol()_h.u53ox2ia3cc: undefined,
      Symbol(observable)_k.u53ox2ia3cc: undefined,
      Symbol(react.element)_g.u53ox2ia3cc: undefined,
      Symbol(Symbol.asyncIterator)_i.u53ox2ia3cc: undefined,
      Symbol(Symbol.observable)_j.u53ox2ia3cc: undefined
   }

Followed by 10 - 15 repeats of

Unhandled promise rejection TypeError:  is not iterable!
   "Unhandled promise rejection"
   {
      [functions]: ,
      __proto__: { },
      message: " is not iterable!",
      name: "TypeError",
      stack: "TypeError:  is not iterable!
   at module.exports (eval code:14:34)
   at Anonymous function (eval code:271:7)
   at perform (eval code:61:5)
   at all (eval code:267:5)
   at shaka.dash.MpdUtils.processXlinks (eval code:288:62)
   at shaka.dash.MpdUtils.processXlinks (eval code:288:2)
   at shaka.dash.MpdUtils.processXlinks (eval code:288:2)
   at shaka.dash.MpdUtils.processXlinks (eval code:288:2)
   at shaka.dash.DashParser.prototype.parseManifest_ (eval code:389:214)
   at Anonymous function (eval code:388:374)",
      Symbol()_h.u53ox2ia3cc: undefined,
      Symbol(observable)_k.u53ox2ia3cc: undefined,
      Symbol(react.element)_g.u53ox2ia3cc: undefined,
      Symbol(Symbol.asyncIterator)_i.u53ox2ia3cc: undefined,
      Symbol(Symbol.observable)_j.u53ox2ia3cc: undefined
   }

Note. If I remove the polyfil then shaka works.

Please let me know if I can help in any way, provide more / clearer details etc.

@theodab
Copy link
Contributor

theodab commented Oct 11, 2017

Shaka Player has its own promise polyfill, which is installed by shaka.poyfill.installAll() if window.Promise isn't defined. Does the problem still happen if you don't import the core-js promise polyfill?

@bengeorge
Copy link
Author

Does the problem still happen if you don't import the core-js promise polyfill?

Yes this still holds true 👍 "Note. If I remove the polyfil then shaka works."

Is it possible that shaka is actually polyfilling more than just promise in promise.js ? I'm not overly familiar with the promise spec but I'll take a look at https://github.com/google/shaka-player/blob/adb8da4764e3080693252ba0211cd4f936fa27be/lib/polyfill/promise.js

@theodab
Copy link
Contributor

theodab commented Oct 11, 2017

Ah, I didn't see that you had addressed that already. My apologies.

Anyway... I'm looking at es6.promise.js, and it looks like their implementation of Promise.all assumes that promises conform to the iterable protocol. We don't use that protocol, to reduce the number of polyfills we need to maintain.
So maybe it's using our implementation of promises, but core-js has overwritten our implementation of Promise.all? I'll look into it further when I have the spare time.

@vaage vaage added type: bug Something isn't working correctly and removed needs triage labels Oct 12, 2017
@joeyparrish joeyparrish added this to the v2.3.0 milestone Oct 16, 2017
@bengeorge
Copy link
Author

bengeorge commented Oct 23, 2017

In case anyone else finds same issue: our temp fix is to just use the shaka polyfil instead of core-js 😅

// There are issues with core-js promise polyfil and shaka in IE11.
// For now we will rely on shaka promise polyfil.
// See: https://github.com/google/shaka-player/issues/1062
// import 'core-js/modules/es6.promise';

import { polyfill } from 'shaka-player';

polyfill.installAll();

@theodab
Copy link
Contributor

theodab commented Oct 23, 2017

Okay, I've done more testing, and I think this might just be a bug with core-js.
I tried loading only the core-js promise module into a browser, without Shaka Player, and typed
Promise.all([Promise.resolve()])
into the IE browser console, and it threw an exception about [object Object] not being iterable.

@theodab theodab added type: external An issue with an external dependency; not our issue; sometimes kept open for tracking and removed type: bug Something isn't working correctly labels Oct 23, 2017
@joeyparrish
Copy link
Member

@theodab, thanks for looking into this. Can you please file a bug on core-js? https://github.com/zloirock/core-js/issues/new

In that bug, please mention google/shaka-player#1062 to link back here for context, and mention @bengeorge and myself. Thanks!

@joeyparrish joeyparrish removed this from the v2.3.0 milestone Oct 23, 2017
@joeyparrish joeyparrish changed the title No playback in IE11 with external Promise polyfil core-js Promise polyfill not working with Shaka Player on IE11 Oct 23, 2017
@theodab
Copy link
Contributor

theodab commented Oct 23, 2017

Looking at core-js's github page, it seems this might be a case of using core-js improperly.
See this and this issue. They warn against using files in core-js/modules/*, as they are internal and not meant to be directly linked unless you really know what you are doing. Instead, they say to include core-js/fn/promise if you want promises.

@joeyparrish
Copy link
Member

Good find. Thanks! @bengeorge, does this help?

@bengeorge
Copy link
Author

bengeorge commented Oct 25, 2017

import 'core-js/fn/promise'; works perfectly 👍

@joeyparrish @theodab You guys are awesome. Thanks a bunch for looking into that!

And sorry for wasting your time 😅 I should have never doubted shaka!

@shaka-project shaka-project locked and limited conversation to collaborators Mar 22, 2018
@shaka-bot shaka-bot added the status: archived Archived and locked; will not be updated label Apr 15, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status: archived Archived and locked; will not be updated type: external An issue with an external dependency; not our issue; sometimes kept open for tracking
Projects
None yet
Development

No branches or pull requests

5 participants