import { Component } from '@angular/core' ; import { DPlayerService } from 'angular-dplayer' ; @ Component ( { selector : 'app-root' , templateUrl : './app.component.html' , styleUrls : [ './app.component.css' ] } ) export class AppComponent { public type : number ; public types = [ 'MP4' , 'HLS' , 'DASH' , 'FLV' ] ; public eventLog = [ ] ; constructor ( private DPService ) { this . type = 0 ; } changeType ( ) { if ( this . type >= this . types . length - 1 ) { this . type = 0 ; } else { this . type ++ ; } } }