@@ -2,13 +2,14 @@ import React from 'react';
22import PropTypes from 'prop-types' ;
33import { Cloudinary , Util } from 'cloudinary-core' ;
44import CloudinaryComponent from '../CloudinaryComponent' ;
5- import { extractCloudinaryProps } from "../../Util" ;
5+ import { VIDEO_MIME_TYPES , extractCloudinaryProps } from "../../Util" ;
66
77/**
88 * A component representing a Cloudinary served video
99 */
1010class Video extends CloudinaryComponent {
1111 mimeType = 'video' ;
12+ mimeSubTypes = VIDEO_MIME_TYPES ;
1213
1314 /**
1415 * Merge context with props
@@ -76,7 +77,7 @@ class Video extends CloudinaryComponent {
7677 * @param publicId - identifier of the video asset
7778 * @param childTransformations - child transformations for this video element
7879 * @param transformations - source transformations for specified source type
79- * @param sourceType - format of the video url
80+ * @param sourceType - format of the video url
8081 * @param mimeType - MIME type if specified source type
8182 */
8283 toSourceTag = ( cld , publicId , childTransformations , transformations , sourceType , mimeType ) => {
@@ -91,11 +92,11 @@ class Video extends CloudinaryComponent {
9192
9293 /**
9394 * Determines MIME type of given source type and codecs.
94- * @param type - format of the video
95+ * @param type - format of the video
9596 * @param codecs - optional information about codecs of the video
9697 */
9798 buildMimeType = ( type , codecs ) => {
98- let mimeType = `${ this . mimeType } /${ type === 'ogv' ? 'ogg' : type } ` ;
99+ let mimeType = `${ this . mimeType } /${ this . mimeSubTypes [ type ] || type } ` ;
99100 if ( ! Util . isEmpty ( codecs ) ) {
100101 mimeType += "; codecs=" + ( Util . isArray ( codecs ) ? codecs . join ( ', ' ) : codecs ) ;
101102 }
0 commit comments