import { Component , OnInit } from '@angular/core' ; import { ConfigService } from '../../providers/config.service' ; import { ActivatedRoute } from '@angular/router' ; import { remote } from 'electron' ; import { NgbModal } from '@ng-bootstrap/ng-bootstrap' ; @ Component ( { selector : 'app-player' , templateUrl : './player.component.html' , styleUrls : [ './player.component.scss' ] } ) export class PlayerComponent implements OnInit { hexString : string ; videoUrl : string ; constructor ( private configService , private route , private modalService ) { } ngOnInit ( ) { this . hexString = this . route . snapshot . paramMap . get ( 'hexString' ) ; this . videoUrl = this . configService . playerUrl + '/' + this . hexString ; const videoEle = document . getElementsByTagName ( 'video' ) [ 0 ] ; const waringButton = document . getElementById ( 'waringButton' ) ; videoEle . addEventListener ( 'error' , function ( ) { alert ( 'Unsupported type' ) ; waringButton . click ( ) ; } , true ) ; videoEle . addEventListener ( 'loadeddata' , function ( ) { waringButton . click ( ) ; } , true ) ; } handleVideoWaring ( content ) { this . modalService . open ( content , { centered : true } ) ; } }