"@types/node": "^6.0.38",
"@types/source-map": "^0.1.26",
"@types/uglify-js": "^2.0.27",
+ "@types/videojs": "0.0.30",
"@types/webpack": "^1.12.29",
"angular-pipes": "^4.0.0",
"angular2-template-loader": "^0.6.0",
import { ModalDirective } from 'ng2-bootstrap/components/modal';
import { MetaService } from 'ng2-meta';
+import * as videojs from 'video.js';
import { Video, VideoService } from '../shared';
import { WebTorrentService } from './webtorrent.service';
error: boolean = false;
loading: boolean = false;
numPeers: number;
+ player: VideoJSPlayer;
uploadSpeed: number;
video: Video = null;
error => alert(error.text)
);
});
+
+ const videojsOptions = {
+ controls: true,
+ autoplay: false
+ };
+
+ const self = this;
+ videojs('video-container', videojsOptions, function () {
+ self.player = this;
+ });
}
ngOnDestroy() {
}
loadVideo() {
-
console.log('<iframe width="560" height="315" src="' + window.location.origin + '/videos/embed/' + this.video.id + '" frameborder="0" allowfullscreen></iframe>');
// Reset the error
this.loading = false;
console.log('Added ' + this.video.magnetUri + '.');
- torrent.files[0].appendTo(this.elementRef.nativeElement.querySelector('.embed-responsive'), (err) => {
+ torrent.files[0].renderTo('#video-container video', { autoplay: true }, (err) => {
if (err) {
alert('Cannot append the file.');
console.error(err);