@cloudinary/html
Advanced tools
@@ -1,2 +0,2 @@ | ||
| import { Plugins, HtmlPluginState, VideoSources, VideoType, VideoPoster } from '../types'; | ||
| import { Plugins, HtmlPluginState, VideoSources, VideoType, VideoPoster, VideoOptions } from '../types'; | ||
| import { CloudinaryVideo } from "@cloudinary/url-gen"; | ||
@@ -19,3 +19,4 @@ export declare class HtmlVideoLayer { | ||
| }; | ||
| constructor(element: HTMLVideoElement | null, userCloudinaryVideo: CloudinaryVideo, sources: VideoSources, plugins?: Plugins, videoAttributes?: object, userCloudinaryPoster?: VideoPoster); | ||
| videoOptions: VideoOptions; | ||
| constructor(element: HTMLVideoElement | null, userCloudinaryVideo: CloudinaryVideo, sources: VideoSources, plugins?: Plugins, videoAttributes?: object, userCloudinaryPoster?: VideoPoster, videoOptions?: VideoOptions); | ||
| /** | ||
@@ -22,0 +23,0 @@ * Handles user supplied sources or default sources |
@@ -6,3 +6,3 @@ import cloneDeep from 'lodash.clonedeep'; | ||
| var HtmlVideoLayer = /** @class */ (function () { | ||
| function HtmlVideoLayer(element, userCloudinaryVideo, sources, plugins, videoAttributes, userCloudinaryPoster) { | ||
| function HtmlVideoLayer(element, userCloudinaryVideo, sources, plugins, videoAttributes, userCloudinaryPoster, videoOptions) { | ||
| var _this = this; | ||
@@ -13,2 +13,3 @@ this.mimeType = 'video'; | ||
| this.originalVideo = userCloudinaryVideo; | ||
| this.videoOptions = videoOptions; | ||
| this.htmlPluginState = { cleanupCallbacks: [], pluginEventSubscription: [] }; | ||
@@ -37,3 +38,3 @@ var pluginCloudinaryVideo = cloneDeep(userCloudinaryVideo); | ||
| defaultTypes.forEach(function (type) { | ||
| _this.appendSourceTag(userCloudinaryVideo, type); | ||
| _this.appendSourceTag(cloneDeep(userCloudinaryVideo), type); | ||
| }); | ||
@@ -62,3 +63,8 @@ } | ||
| HtmlVideoLayer.prototype.appendSourceTag = function (userCloudinaryVideo, type, mimeType) { | ||
| var _a; | ||
| var source = document.createElement('source'); | ||
| var shouldUseFetchFormat = (_a = this.videoOptions) === null || _a === void 0 ? void 0 : _a.useFetchFormat; | ||
| if (shouldUseFetchFormat) { | ||
| userCloudinaryVideo.format(type); | ||
| } | ||
| var url = userCloudinaryVideo.toURL(); | ||
@@ -70,3 +76,4 @@ // Split url to get analytics string so that we can insert the file extension (type) before it | ||
| var analyticsStr = srcParts[1] ? "".concat(ANALYTICS_DELIMITER).concat(srcParts[1]) : ''; | ||
| source.src = "".concat(srcParts[0], ".").concat(type).concat(analyticsStr); | ||
| var ext = shouldUseFetchFormat ? '' : ".".concat(type); | ||
| source.src = "".concat(srcParts[0]).concat(ext).concat(analyticsStr); | ||
| // Ideally, we want to use the VIDEO_MIME_TYPE to detect the mime of the extension | ||
@@ -73,0 +80,0 @@ // For future proofing of simple formats (say .foo and mimetype of video/foo), we also fallback to the actual type |
+1
-1
| { | ||
| "name": "@cloudinary/html", | ||
| "version": "1.12.0", | ||
| "version": "1.13.0", | ||
| "description": "An HTML wrapper for Cloudinary", | ||
@@ -5,0 +5,0 @@ "main": "./index.js", |
+3
-0
@@ -40,2 +40,5 @@ import { CloudinaryImage } from "@cloudinary/url-gen/assets/CloudinaryImage"; | ||
| export type VideoPoster = CloudinaryImage | 'auto'; | ||
| export type VideoOptions = { | ||
| useFetchFormat?: boolean; | ||
| }; | ||
| export {}; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
1199525
0.48%12339
0.37%