SamirHodzic / ngx-embed-video

Get embed code for embedding youtube/vimeo/dailymotion/* video in websites from URL or ID in Angular 6+.
MIT License
56 stars 41 forks source link

Doesn't work in IE11. Object doesn't support this action #19

Closed adamkovuch closed 5 years ago

adamkovuch commented 5 years ago

Hello, embed() function doesn't work in IE 11. Got 'Object doesn't support this action' error. It works in other browsers. Could you please advise?

ERROR TypeError: Object doesn't support this action "ERROR" {

  __proto__: { },
  description: "Object doesn't support this action",
  message: "Object doesn't support this action",
  name: "TypeError",
  ngDebugContext: { },
  number: -2146827843,
  stack: "TypeError: Object doesn't support this action

at EmbedVideoService.prototype.embed (http://localhost:4200/vendor.js:102331:9) at PortfolioItemPageComponent.prototype.getVideoFrame (http://localhost:4200/main.js:3563:9) at Anonymous function (http://localhost:4200/main.js:3659:21) at PortfolioItemPageComponent.prototype.updateVideolinksToFrame (http://localhost:4200/main.js:3655:9) at PortfolioItemPageComponent.prototype.test (http://localhost:4200/main.js:3560:9) at Anonymous function (Function code:691:15) at handleEvent (http://localhost:4200/vendor.js:49067:9) at callWithDebugContext (http://localhost:4200/vendor.js:50160:9) at debugHandleEvent (http://localhost:4200/vendor.js:49863:5) at dispatchEvent (http://localhost:4200/vendor.js:46526:9)", Symbol(rxSubscriber)_g.jc4utky2gqc: undefined, Symbol(rxSubscriber)_h.jc4utky2gqc: undefined }

SamirHodzic commented 5 years ago

Hi @adamkovuch, In order to support IE11 (or other older browsers) some js features need to be polyfilled.

Can you try adding this to polyfill.ts inside your project:

import 'core-js/es6/object';
// or
import 'core-js/es7/object';

Let me know if this helped you.

adamkovuch commented 5 years ago

It's already included. Also, the application works ok, but when I call embed() function, I get such error.

SamirHodzic commented 5 years ago

Afaik, you should also need this meta header in your index.html

<meta http-equiv="X-UA-Compatible" content="IE=edge" />
adamkovuch commented 5 years ago

It doesn't help, the same problem.

Thanks

adamkovuch commented 5 years ago

Hello, I used https://www.npmjs.com/package/embed-video and this problem doesn't appear. So the issue is resolved for me. Thanks.

onedotover commented 5 years ago

The issue is here: https://github.com/SamirHodzic/ngx-embed-video/blob/e11fb72c501612b196f5c557f22ed2855e2035c1/src/embed-video.service.ts#L37-L40

IE does not support new URL(). To work around this issue you can do the following: 1. Install url-polyfill npm install --save url-polyfill

2. Include url-polyfill in polyfills.ts

/***************************************************************************************************
 * APPLICATION IMPORTS
 */
// Needed for ngx-embed-video
import 'url-polyfill';
NikitaPooja commented 5 years ago

onedotover thanks its work you save my time