import 'dashjs/dist/dash.all.min.js' ; import { PlyrDriver , PlyrDriverCreateParams , PlyrDriverDestroyParams , PlyrDriverUpdateSourceParams } from 'ngx-plyr' ; import * as Plyr from 'plyr' ; declare const dashjs ; export class DashjsPlyrDriver implements PlyrDriver { dash = dashjs . MediaPlayer ( ) . create ( ) ; private videoElement : HTMLVideoElement ; private loaded = false ; constructor ( private autoload ) { this . dash . getDebug ( ) . setLogToBrowserConsole ( false ) ; } create ( params ) { this . videoElement = params . videoElement ; return new Plyr ( params . videoElement , params . options ) ; } updateSource ( params ) { if ( this . autoload ) { this . load ( params . source . sources [ 0 ] . src ) ; } else { params . videoElement . poster = params . source . poster ; } } destroy ( params ) { params . plyr . destroy ( ) ; } load ( src ) { if ( ! this . loaded ) { this . loaded = true ; this . dash . initialize ( this . videoElement , src , false ) ; } } }