brightcove / player-loader

An asynchronous script loader and embed generator for the Brightcove Player.
Other
28 stars 15 forks source link

Not working in Angular 7 #59

Closed wautersj closed 5 years ago

wautersj commented 5 years ago

Created an Ionic 4 app. Basically this is the same as an Angular app, created with CLI.

Used the import in the page-component where I need the video te be.

import brightcovePlayerLoader from '@brightcove/player-loader';

Ran the basic setup with the documented function in the page-component.

brightcovePlayerLoader({
  refNode: '#player-container',
  accountId: '1475651728001',
  videoId: '6052029296001',
  refNodeInsert: 'replace',
  embedId: 'default'
}).then(function(success) {
  // The player has been created!
  console.log('success', success);
}).catch(function(error) {
  // Player creation failed!
  console.log('error', error);
});

... and in the page-template.

<!-- Brightcove-player -->
<div id="player-container"></div>

But only a black square is presented. I'm getting two errors in the console, which might contain more information.

ERROR TypeError: this.el_.addTextTrack is not a function

index.min.js:9 VIDEOJS: ERROR: TypeError: Cannot read property 'length' of undefined

Screenshot 2019-09-05 at 16 42 03

Screenshot 2019-09-05 at 16 41 42

Dependencies and versions:

"@angular/common": "^7.2.2", "@angular/core": "^7.2.2", "@angular/forms": "^7.2.2", "@angular/http": "^7.2.2", "@angular/platform-browser": "^7.2.2", "@angular/platform-browser-dynamic": "^7.2.2", "@angular/router": "^7.2.2", "@brightcove/player-loader": "^1.7.1", "@ionic-native/core": "^5.0.0", "@ionic-native/in-app-browser": "^5.12.0", "@ionic-native/splash-screen": "^5.0.0", "@ionic-native/status-bar": "^5.0.0", "@ionic/angular": "^4.1.0", "@ionic/storage": "^2.2.0", "cordova-ios": "^5.0.1", "cordova-plugin-inappbrowser": "^3.1.0", "core-js": "^2.5.4", "ionic-cache": "^4.0.1", "ng-circle-progress": "^1.4.0", "rxjs": "~6.5.1", "rxjs-compat": "^6.5.2", "tslib": "^1.9.0", "zone.js": "~0.8.29"

wautersj commented 5 years ago

Didn't know there was a somewhat simmular issue, which already got resolved. Adding the 'EMBED_TAG_NAME_VIDEO' does the trick.

brightcovePlayerLoader({
          refNode: '#player-container',
          accountId: '1475651728001',
          videoId: '6052029296001',
          refNodeInsert: 'replace',
          embedOptions: {
            tagName: brightcovePlayerLoader.EMBED_TAG_NAME_VIDEO
          }
        })