cloudinary-video-player
Version:
Cloudinary Video Player
136 lines (102 loc) • 20.5 kB
JavaScript
/*!
* Cloudinary Video Player v4.0.3
* Built on 2026-06-07T12:24:04.618Z
* https://github.com/cloudinary/cloudinary-video-player
*/
/*
* ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
* This devtool is neither made for production nor for readable output files.
* It uses "eval()" calls to create a separate source file in the browser devtools.
* If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
* or disable the default devtool with "devtool: false".
* If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
*/
(self["cloudinaryVideoPlayerChunkLoading"] = self["cloudinaryVideoPlayerChunkLoading"] || []).push([["utils_fetch-config_js"],{
/***/ "./plugins/cloudinary/profile-url-pattern.js"
/*!***************************************************!*\
!*** ./plugins/cloudinary/profile-url-pattern.js ***!
\***************************************************/
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ URL_PATTERN: () => (/* binding */ URL_PATTERN)\n/* harmony export */ });\n/**\n * Detects http(s) profile/config URLs. Split from `video-source.const` so fetch-config\n * does not pull MIME maps and related defaults into the async chunk.\n */\n// eslint-disable-next-line no-control-regex\nconst URL_PATTERN = RegExp('https?:\\\\/\\\\/(www\\\\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\\\\.[a-zA-Z0-9()]{1,6}\\\\b([-a-zA-Z0-9()@:%_+.~#?&/=]*)');\n\n//# sourceURL=webpack:///./plugins/cloudinary/profile-url-pattern.js?\n}");
/***/ },
/***/ "./plugins/cloudinary/url-helpers.js"
/*!*******************************************!*\
!*** ./plugins/cloudinary/url-helpers.js ***!
\*******************************************/
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ getCloudinaryUrlPrefix: () => (/* reexport safe */ _utils_cloudinary_url_prefix__WEBPACK_IMPORTED_MODULE_1__.getCloudinaryUrlPrefix),\n/* harmony export */ isRawUrl: () => (/* binding */ isRawUrl)\n/* harmony export */ });\n/* harmony import */ var _profile_url_pattern__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./profile-url-pattern */ \"./plugins/cloudinary/profile-url-pattern.js\");\n/* harmony import */ var _utils_cloudinary_url_prefix__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../utils/cloudinary-url-prefix */ \"./utils/cloudinary-url-prefix.js\");\n\n\nconst isRawUrl = publicId => _profile_url_pattern__WEBPACK_IMPORTED_MODULE_0__.URL_PATTERN.test(publicId);\n\n//# sourceURL=webpack:///./plugins/cloudinary/url-helpers.js?\n}");
/***/ },
/***/ "./utils/cloudinary-config-from-options.js"
/*!*************************************************!*\
!*** ./utils/cloudinary-config-from-options.js ***!
\*************************************************/
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ getCloudinaryConfigFromOptions: () => (/* binding */ getCloudinaryConfigFromOptions)\n/* harmony export */ });\n/* harmony import */ var _cloudinary_config_param__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./cloudinary-config-param */ \"./utils/cloudinary-config-param.js\");\n\nconst CLOUDINARY_CONFIG_KEYS = new Set(_cloudinary_config_param__WEBPACK_IMPORTED_MODULE_0__.CLOUDINARY_CONFIG_PARAM);\n\n/**\n * Matches lodash `snakeCase` (avoids heavy lodash in lazy-player).\n */\nconst toSnakeCase = key => key.replace(/([a-z0-9])([A-Z])/g, '$1_$2').replace(/[-\\s]+/g, '_').toLowerCase();\nconst pickCloudinaryKeysFromOptions = options => {\n const out = {};\n for (const key of Object.keys(options)) {\n const snake = toSnakeCase(key);\n if (CLOUDINARY_CONFIG_KEYS.has(snake)) {\n out[snake] = options[key];\n }\n }\n return out;\n};\nconst getCloudinaryConfigFromOptions = options => {\n if (options.cloudinaryConfig) {\n return options.cloudinaryConfig;\n }\n return Object.assign({}, pickCloudinaryKeysFromOptions(options));\n};\n\n//# sourceURL=webpack:///./utils/cloudinary-config-from-options.js?\n}");
/***/ },
/***/ "./utils/cloudinary-config-param.js"
/*!******************************************!*\
!*** ./utils/cloudinary-config-param.js ***!
\******************************************/
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ CLOUDINARY_CONFIG_PARAM: () => (/* binding */ CLOUDINARY_CONFIG_PARAM)\n/* harmony export */ });\n/**\n * Cloudinary SDK config keys (snake_case). Duplicated from `video-player.const` so\n * modules that only need this list do not import the full player constants table.\n */\nconst CLOUDINARY_CONFIG_PARAM = ['api_secret', 'auth_token', 'cdn_subdomain', 'cloud_name', 'cname', 'private_cdn', 'secure', 'secure_cdn_subdomain', 'secure_distribution', 'shorten', 'sign_url', 'url_suffix', 'use_root_path'];\n\n//# sourceURL=webpack:///./utils/cloudinary-config-param.js?\n}");
/***/ },
/***/ "./utils/cloudinary-url-prefix.js"
/*!****************************************!*\
!*** ./utils/cloudinary-url-prefix.js ***!
\****************************************/
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ getCloudinaryUrlPrefix: () => (/* binding */ getCloudinaryUrlPrefix)\n/* harmony export */ });\n/* harmony import */ var _cloudinary_url_gen_backwards_utils_unsigned_url_prefix__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @cloudinary/url-gen/backwards/utils/unsigned_url_prefix */ \"../node_modules/@cloudinary/url-gen/backwards/utils/unsigned_url_prefix.js\");\n\nconst getCloudinaryUrlPrefix = cloudinaryConfig => {\n return (0,_cloudinary_url_gen_backwards_utils_unsigned_url_prefix__WEBPACK_IMPORTED_MODULE_0__.unsigned_url_prefix)(null, cloudinaryConfig.cloud_name, cloudinaryConfig.private_cdn, cloudinaryConfig.cdn_subdomain, cloudinaryConfig.secure_cdn_subdomain, cloudinaryConfig.cname, cloudinaryConfig.secure ?? true, cloudinaryConfig.secure_distribution);\n};\n\n//# sourceURL=webpack:///./utils/cloudinary-url-prefix.js?\n}");
/***/ },
/***/ "./utils/fetch-config.js"
/*!*******************************!*\
!*** ./utils/fetch-config.js ***!
\*******************************/
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ fetchAndMergeConfig: () => (/* binding */ fetchAndMergeConfig)\n/* harmony export */ });\n/* harmony import */ var cloudinary_video_player_profiles__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! cloudinary-video-player-profiles */ \"../node_modules/cloudinary-video-player-profiles/dist/index.js\");\n/* harmony import */ var cloudinary_video_player_profiles__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(cloudinary_video_player_profiles__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _plugins_cloudinary_url_helpers__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../plugins/cloudinary/url-helpers */ \"./plugins/cloudinary/url-helpers.js\");\n/* harmony import */ var _utils_utf8Base64__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../utils/utf8Base64 */ \"./utils/utf8Base64.js\");\n/* harmony import */ var _querystring__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./querystring */ \"./utils/querystring.js\");\n/* harmony import */ var _cloudinary_config_from_options__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./cloudinary-config-from-options */ \"./utils/cloudinary-config-from-options.js\");\n\n\n\n\n\nconst isDefaultProfile = profileName => !!cloudinary_video_player_profiles__WEBPACK_IMPORTED_MODULE_0__.defaultProfiles.find(_ref => {\n let {\n name\n } = _ref;\n return profileName === name;\n});\nconst getDefaultProfileConfig = profileName => {\n const profile = cloudinary_video_player_profiles__WEBPACK_IMPORTED_MODULE_0__.defaultProfiles.find(_ref2 => {\n let {\n name\n } = _ref2;\n return profileName === name;\n });\n if (!profile) {\n throw new Error(`Default profile with name ${profileName} does not exist`);\n }\n return profile.config;\n};\nconst fetchConfig = async options => {\n const {\n profile,\n publicId,\n type = 'upload',\n videoConfig,\n allowUsageReport = true\n } = options;\n if (profile && isDefaultProfile(profile)) {\n return getDefaultProfileConfig(profile);\n }\n const cloudinaryConfig = (0,_cloudinary_config_from_options__WEBPACK_IMPORTED_MODULE_4__.getCloudinaryConfigFromOptions)(options);\n const urlPrefix = (0,_plugins_cloudinary_url_helpers__WEBPACK_IMPORTED_MODULE_1__.getCloudinaryUrlPrefix)(cloudinaryConfig) + '/_applet_/video_service';\n const queryParams = allowUsageReport ? {\n _s: 'vp'\n } : null;\n let configUrl;\n if (profile) {\n configUrl = (0,_plugins_cloudinary_url_helpers__WEBPACK_IMPORTED_MODULE_1__.isRawUrl)(profile) ? profile : (0,_querystring__WEBPACK_IMPORTED_MODULE_3__.appendQueryParams)(`${urlPrefix}/video_player_profiles/${profile.replaceAll(' ', '+')}.json`, queryParams);\n } else if (publicId && videoConfig !== false) {\n configUrl = (0,_querystring__WEBPACK_IMPORTED_MODULE_3__.appendQueryParams)(`${urlPrefix}/video_player_config/video/${type}/${(0,_utils_utf8Base64__WEBPACK_IMPORTED_MODULE_2__.utf8ToBase64)(publicId)}.json`, queryParams);\n } else {\n return {};\n }\n return fetch(configUrl, {\n method: 'GET'\n }).then(res => {\n if (!res.ok) {\n // fail silently\n return {};\n }\n return res.json();\n });\n};\nconst fetchAndMergeConfig = async options => {\n const profileOptions = await fetchConfig(options);\n const fetchedConfig = profileOptions.playerOptions ? Object.keys(profileOptions.playerOptions) : [];\n const profileAnalytics = {\n _internalAnalyticsMetadata: {\n newPlayerMethod: true,\n ...(options.profile ? {\n profile: isDefaultProfile(options.profile) ? options.profile : true\n } : {}),\n ...(!options.profile && options.videoConfig !== false && options.publicId ? {\n videoConfig: true\n } : {}),\n ...(fetchedConfig.length > 0 ? {\n fetchedConfig: fetchedConfig.join(',')\n } : {})\n }\n };\n return Object.assign({}, profileOptions.playerOptions || {}, profileOptions.sourceOptions || {}, options, profileAnalytics);\n};\n\n//# sourceURL=webpack:///./utils/fetch-config.js?\n}");
/***/ },
/***/ "./utils/querystring.js"
/*!******************************!*\
!*** ./utils/querystring.js ***!
\******************************/
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ appendQueryParams: () => (/* binding */ appendQueryParams)\n/* harmony export */ });\nconst appendQueryParams = (url, params) => {\n if (!params || !Object.keys(params).length) {\n return url;\n }\n const urlObj = new URL(url);\n Object.entries(params).forEach(_ref => {\n let [key, value] = _ref;\n if (value != null) {\n urlObj.searchParams.append(key, value);\n }\n });\n return urlObj.href;\n};\n\n\n//# sourceURL=webpack:///./utils/querystring.js?\n}");
/***/ },
/***/ "./utils/utf8Base64.js"
/*!*****************************!*\
!*** ./utils/utf8Base64.js ***!
\*****************************/
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ utf8ToBase64: () => (/* binding */ utf8ToBase64)\n/* harmony export */ });\nfunction utf8ToBase64(str) {\n const utf8Bytes = new TextEncoder().encode(str);\n const binaryStr = String.fromCharCode(...utf8Bytes);\n return btoa(binaryStr);\n}\n\n//# sourceURL=webpack:///./utils/utf8Base64.js?\n}");
/***/ },
/***/ "../node_modules/cloudinary-video-player-profiles/dist/index.js"
/*!**********************************************************************!*\
!*** ../node_modules/cloudinary-video-player-profiles/dist/index.js ***!
\**********************************************************************/
(__unused_webpack_module, exports) {
eval("{var e={607:function(e,o,t){var l=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(o,\"__esModule\",{value:!0}),o.defaultProfiles=o.cldLiveStreamingProfile=o.cldAdaptiveStreamProfile=o.cldLoopingProfile=o.cldDefaultProfile=void 0;const r=l(t(704)),i=l(t(83)),a=l(t(832)),s=l(t(877));o.cldDefaultProfile={name:\"cld-default\",isDefault:!0,config:r.default},o.cldLoopingProfile={name:\"cld-looping\",isDefault:!0,config:i.default},o.cldAdaptiveStreamProfile={name:\"cld-adaptive-stream\",isDefault:!0,config:a.default},o.cldLiveStreamingProfile={name:\"cld-live-streaming\",isDefault:!0,config:s.default},o.defaultProfiles=[o.cldDefaultProfile,o.cldLoopingProfile,o.cldAdaptiveStreamProfile,o.cldLiveStreamingProfile]},832:e=>{e.exports=JSON.parse('{\"playerOptions\":{\"fluid\":true,\"controls\":true,\"controlBar\":{\"fullscreenToggle\":false},\"showJumpControls\":true,\"hideContextMenu\":false,\"floatingWhenNotVisible\":\"none\"},\"sourceOptions\":{\"chapters\":true,\"sourceTypes\":[\"hls\"]}}')},704:e=>{e.exports=JSON.parse('{\"playerOptions\":{},\"sourceOptions\":{}}')},877:e=>{e.exports=JSON.parse('{\"playerOptions\":{},\"sourceOptions\":{\"type\":\"live\",\"sourceTypes\":[\"hls\"]}}')},83:e=>{e.exports=JSON.parse('{\"playerOptions\":{\"fluid\":true,\"controls\":false,\"muted\":true,\"floatingWhenNotVisible\":\"none\",\"hideContextMenu\":false,\"autoplay\":true,\"loop\":true},\"sourceOptions\":{}}')}},o={},t=function t(l){var r=o[l];if(void 0!==r)return r.exports;var i=o[l]={exports:{}};return e[l].call(i.exports,i,i.exports,t),i.exports}(607),l=exports;for(var r in t)l[r]=t[r];t.__esModule&&Object.defineProperty(l,\"__esModule\",{value:!0});\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack:///../node_modules/cloudinary-video-player-profiles/dist/index.js?\n}");
/***/ },
/***/ "../node_modules/@cloudinary/url-gen/backwards/consts.js"
/*!***************************************************************!*\
!*** ../node_modules/@cloudinary/url-gen/backwards/consts.js ***!
\***************************************************************/
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
"use strict";
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ AKAMAI_SHARED_CDN: () => (/* binding */ AKAMAI_SHARED_CDN),\n/* harmony export */ CF_SHARED_CDN: () => (/* binding */ CF_SHARED_CDN),\n/* harmony export */ LAYER_KEYWORD_PARAMS: () => (/* binding */ LAYER_KEYWORD_PARAMS),\n/* harmony export */ LEGACY_CONDITIONAL_OPERATORS: () => (/* binding */ LEGACY_CONDITIONAL_OPERATORS),\n/* harmony export */ LEGACY_PREDEFINED_VARS: () => (/* binding */ LEGACY_PREDEFINED_VARS),\n/* harmony export */ NUMBER_PATTERN: () => (/* binding */ NUMBER_PATTERN),\n/* harmony export */ OFFSET_ANY_PATTERN: () => (/* binding */ OFFSET_ANY_PATTERN),\n/* harmony export */ OFFSET_ANY_PATTERN_RE: () => (/* binding */ OFFSET_ANY_PATTERN_RE),\n/* harmony export */ OLD_AKAMAI_SHARED_CDN: () => (/* binding */ OLD_AKAMAI_SHARED_CDN),\n/* harmony export */ RANGE_VALUE_RE: () => (/* binding */ RANGE_VALUE_RE),\n/* harmony export */ SHARED_CDN: () => (/* binding */ SHARED_CDN)\n/* harmony export */ });\nconst LEGACY_CONDITIONAL_OPERATORS = {\n \"=\": 'eq',\n \"!=\": 'ne',\n \"<\": 'lt',\n \">\": 'gt',\n \"<=\": 'lte',\n \">=\": 'gte',\n \"&&\": 'and',\n \"||\": 'or',\n \"*\": \"mul\",\n \"/\": \"div\",\n \"+\": \"add\",\n \"-\": \"sub\",\n \"^\": \"pow\"\n};\nconst CF_SHARED_CDN = \"d3jpl91pxevbkh.cloudfront.net\";\nconst OLD_AKAMAI_SHARED_CDN = \"cloudinary-a.akamaihd.net\";\nconst AKAMAI_SHARED_CDN = \"res.cloudinary.com\";\nconst SHARED_CDN = AKAMAI_SHARED_CDN;\nconst LEGACY_PREDEFINED_VARS = {\n \"aspect_ratio\": \"ar\",\n \"aspectRatio\": \"ar\",\n \"current_page\": \"cp\",\n \"currentPage\": \"cp\",\n \"duration\": \"du\",\n \"face_count\": \"fc\",\n \"faceCount\": \"fc\",\n \"height\": \"h\",\n \"initial_aspect_ratio\": \"iar\",\n \"initial_height\": \"ih\",\n \"initial_width\": \"iw\",\n \"initialAspectRatio\": \"iar\",\n \"initialHeight\": \"ih\",\n \"initialWidth\": \"iw\",\n \"initial_duration\": \"idu\",\n \"initialDuration\": \"idu\",\n \"page_count\": \"pc\",\n \"page_x\": \"px\",\n \"page_y\": \"py\",\n \"pageCount\": \"pc\",\n \"pageX\": \"px\",\n \"pageY\": \"py\",\n \"tags\": \"tags\",\n \"width\": \"w\"\n};\nconst NUMBER_PATTERN = \"([0-9]*)\\\\.([0-9]+)|([0-9]+)\";\nconst OFFSET_ANY_PATTERN = `(${NUMBER_PATTERN})([%pP])?`;\nconst RANGE_VALUE_RE = RegExp(`^${OFFSET_ANY_PATTERN}$`);\nconst OFFSET_ANY_PATTERN_RE = RegExp(`(${OFFSET_ANY_PATTERN})\\\\.\\\\.(${OFFSET_ANY_PATTERN})`);\nconst LAYER_KEYWORD_PARAMS = {\n font_weight: \"normal\",\n font_style: \"normal\",\n text_decoration: \"none\",\n text_align: '',\n stroke: \"none\"\n};\n\n\n//# sourceURL=webpack:///../node_modules/@cloudinary/url-gen/backwards/consts.js?\n}");
/***/ },
/***/ "../node_modules/@cloudinary/url-gen/backwards/utils/unsigned_url_prefix.js"
/*!**********************************************************************************!*\
!*** ../node_modules/@cloudinary/url-gen/backwards/utils/unsigned_url_prefix.js ***!
\**********************************************************************************/
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
"use strict";
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ unsigned_url_prefix: () => (/* binding */ unsigned_url_prefix)\n/* harmony export */ });\n/* harmony import */ var _consts_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../consts.js */ \"../node_modules/@cloudinary/url-gen/backwards/consts.js\");\n\nfunction unsigned_url_prefix(source, cloud_name, private_cdn, cdn_subdomain, secure_cdn_subdomain, cname, secure, secure_distribution) {\n let prefix;\n if (cloud_name.indexOf(\"/\") === 0) {\n return '/res' + cloud_name;\n }\n let shared_domain = !private_cdn;\n if (secure) {\n if ((secure_distribution == null) || secure_distribution === _consts_js__WEBPACK_IMPORTED_MODULE_0__.OLD_AKAMAI_SHARED_CDN) {\n secure_distribution = private_cdn ? cloud_name + \"-res.cloudinary.com\" : _consts_js__WEBPACK_IMPORTED_MODULE_0__.SHARED_CDN;\n }\n if (shared_domain == null) {\n shared_domain = secure_distribution === _consts_js__WEBPACK_IMPORTED_MODULE_0__.SHARED_CDN;\n }\n prefix = 'https://' + secure_distribution;\n }\n else if (cname) {\n // let subdomain = cdn_subdomain ? 'a' + ((crc32(source) % 5) + 1) + '.' : '';\n prefix = 'http://' + cname;\n }\n else {\n let cdn_part = private_cdn ? cloud_name + '-' : '';\n let host = [cdn_part, 'res', '.cloudinary.com'].join('');\n prefix = 'http://' + host;\n }\n if (shared_domain) {\n prefix += '/' + cloud_name;\n }\n return prefix;\n}\n\n\n//# sourceURL=webpack:///../node_modules/@cloudinary/url-gen/backwards/utils/unsigned_url_prefix.js?\n}");
/***/ }
}]);