@@ -18,15 +18,16 @@ class Video extends CloudinaryComponent {
1818 }
1919
2020 render ( ) {
21- let { publicId, poster, sourceTypes, fallback, sourceTransformation, ...options } = Object . assign ( { } ,
21+ let { publicId, poster, sourceTypes, fallback, sourceTransformation : sourceTransformations , ...options } = Object . assign ( { } ,
2222 this . context ,
2323 this . props ) ;
24- sourceTransformation = sourceTransformation || { } ;
24+ sourceTransformations = sourceTransformations || { } ;
2525 sourceTypes = sourceTypes || Cloudinary . DEFAULT_VIDEO_PARAMS . source_types ;
2626 options = CloudinaryComponent . normalizeOptions ( options , { } ) ;
2727 let cld = Cloudinary . new ( Util . withSnakeCaseKeys ( options ) ) ;
2828 let sources = [ ] ;
2929 let tagAttributes = Transformation . new ( options ) . toHtmlAttributes ( ) ;
30+ let childTransformations = this . getTransformation ( options ) ;
3031 if ( Util . isPlainObject ( poster ) ) {
3132 let defaults = poster . publicId !== undefined && poster . publicId !== null ? Cloudinary . DEFAULT_IMAGE_PARAMS : DEFAULT_POSTER_OPTIONS ;
3233 poster = cld . url ( poster . publicId || publicId , Util . defaults ( { } , Util . withSnakeCaseKeys ( poster ) , defaults ) ) ;
@@ -40,15 +41,17 @@ class Video extends CloudinaryComponent {
4041
4142 if ( Util . isArray ( sourceTypes ) ) {
4243 sources = sourceTypes . map ( srcType => {
43- let transformation = sourceTransformation [ srcType ] || { } ;
44- let src = cld . url ( publicId , Util . defaults ( { } , transformation , { resource_type : 'video' , format : srcType } ) ) ;
44+ let sourceTransformation = sourceTransformations [ srcType ] || { } ;
45+ let src = cld . url ( publicId , Util . defaults ( { } , sourceTransformation , childTransformations , { resource_type : 'video' , format : srcType } ) ) ;
4546 let mimeType = 'video/' + ( srcType === 'ogv' ? 'ogg' : srcType ) ;
46- return < source key = { mimeType } src = { src } type = { mimeType } /> ;
47+ return < source key = { mimeType } src = { src } type = { mimeType } /> ;
4748 }
4849 ) ;
4950 } else {
50- tagAttributes [ "src" ] = cld . url ( publicId , { resource_type : 'video' , format : sourceTypes } ) ;
51+ let sourceTransformation = sourceTransformations [ sourceTypes ] || { } ;
52+ tagAttributes . src = cld . url ( publicId , Util . defaults ( { } , sourceTransformation , childTransformations , { resource_type : 'video' , format : sourceTypes } ) ) ;
5153 }
54+
5255 return (
5356 < video { ...tagAttributes } >
5457 { sources }
0 commit comments