A brief guide on how to build a THEOplayer in an Angular environment.
Note that this information is for a basic player in a local testing environment. Additional information may be needed for specific cases.
npm install -g @angular/cli
cd appname
ng generate component theoplayer
<div class="theoplayer-container video-js theoplayer-skin"></div>
import { Component, OnInit } from '@angular/core';
import * as THEOplayer from '../../../THEOplayer.js';
@Component({
selector: 'app-theoplayer',
templateUrl: './theoplayer.component.html',
styleUrls: ['./theoplayer.component.css']
})
export class TheoplayerComponent implements OnInit {
constructor() { }
ngOnInit() {
this.createPlayer();
}
createPlayer() {
const element = document.querySelector('.theoplayer-container');
const player = new THEOplayer.Player(element, {
libraryLocation : ''
});
player.source = {
sources : [{
src : '//cdn.theoplayer.com/video/elephants-dream/playlist.m3u8',
type : 'application/x-mpegurl' // sets type to MPEG-DASH
}]
};
}
}
Then
import * as THEOplayer from '../../../THEOplayer.js;
will make sure to get everything needed from our sdk.
<app-theoplayer></app-theoplayer>