11import { Component , OnInit , Input , ElementRef , EventEmitter , Output , OnChanges , OnDestroy } from '@angular/core' ;
2- import { CloudinaryVideo } from '@cloudinary/url-gen' ;
2+ import { CloudinaryImage , CloudinaryVideo } from '@cloudinary/url-gen' ;
3+
34import {
45 cancelCurrentlyRunningPlugins ,
56 HtmlVideoLayer ,
@@ -13,6 +14,7 @@ import {
1314 * @type {Component }
1415 * @description The Cloudinary video component.
1516 * @prop {CloudinaryVideo } transformation Generated by @cloudinary/url-gen
17+ * @prop {CloudinaryImage | "auto" } transformation Generated by @cloudinary/url-gen
1618 * @prop {Plugins } plugins Advanced image component plugins lazyload()
1719 * @prop videoAttributes Optional attributes include controls, loop, muted, poster, preload, autoplay
1820 * @prop videoEvents Optional video events include play, loadstart, playing, error, ended
@@ -50,6 +52,7 @@ export class CloudinaryVideoComponent implements OnInit, OnChanges, OnDestroy {
5052 constructor ( private el : ElementRef ) { }
5153
5254 @Input ( 'cldVid' ) cldVid : CloudinaryVideo ;
55+ @Input ( 'cldPoster' ) cldPoster : CloudinaryImage | 'auto' ;
5356 @Input ( 'sources' ) sources : VideoSources ;
5457 @Input ( 'plugins' ) plugins : Plugins ;
5558 @Input ( 'poster' ) poster : string ;
@@ -82,7 +85,8 @@ export class CloudinaryVideoComponent implements OnInit, OnChanges, OnDestroy {
8285 this . cldVid ,
8386 this . sources ,
8487 this . plugins ,
85- this . getVideoAttributes ( )
88+ this . getVideoAttributes ( ) ,
89+ this . cldPoster
8690 ) ;
8791
8892 // check if video should be muted. We need to take care of this here since Angular has a bug with binding the muted
@@ -102,7 +106,7 @@ export class CloudinaryVideoComponent implements OnInit, OnChanges, OnDestroy {
102106 ngOnChanges ( ) {
103107 if ( this . htmlVideoLayerInstance ) {
104108 cancelCurrentlyRunningPlugins ( this . htmlVideoLayerInstance . htmlPluginState ) ;
105- this . htmlVideoLayerInstance . update ( this . cldVid , this . sources , this . plugins , this . getVideoAttributes ( ) ) ;
109+ this . htmlVideoLayerInstance . update ( this . cldVid , this . sources , this . plugins , this . getVideoAttributes ( ) , this . cldPoster ) ;
106110 }
107111 }
108112
0 commit comments