cloudinary-video-player 2.6.1-edge.0 → 2.6.1-edge.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -16
- package/dist/adaptive-streaming.js +36932 -0
- package/dist/adaptive-streaming.min.js +11 -0
- package/dist/chapters.js +6 -1
- package/dist/chapters.min.js +6 -1
- package/dist/cld-video-player.css +205 -11
- package/dist/cld-video-player.js +37521 -79652
- package/dist/cld-video-player.light.js +202 -662
- package/dist/cld-video-player.light.min.js +10 -3
- package/dist/cld-video-player.min.css +5 -1
- package/dist/cld-video-player.min.js +8 -2
- package/dist/colors.js +91 -0
- package/dist/colors.min.js +7 -0
- package/dist/dash.js +67 -2
- package/dist/dash.min.js +1071 -2
- package/dist/debug.js +145 -90
- package/dist/debug.min.js +6 -1
- package/dist/ima.js +71 -3
- package/dist/ima.min.js +6 -1
- package/dist/interaction-areas.js +92 -4
- package/dist/interaction-areas.min.js +6 -1
- package/dist/node_modules_lodash_throttle_js.js +5 -0
- package/dist/playlist.js +14 -9
- package/dist/playlist.min.js +6 -1
- package/dist/recommendations-overlay.js +12 -7
- package/dist/recommendations-overlay.min.js +6 -1
- package/dist/shoppable.js +12 -7
- package/dist/shoppable.min.js +6 -1
- package/dist/srt-text-tracks.js +213 -0
- package/dist/srt-text-tracks.min.js +7 -0
- package/dist/visual-search.js +9 -4
- package/dist/visual-search.min.js +6 -1
- package/lib/adaptive-streaming.js +3 -0
- package/lib/adaptive-streaming.js.LICENSE.txt +3 -0
- package/lib/all.js +1 -1
- package/lib/all.js.LICENSE.txt +18 -12
- package/lib/chapters.js +1 -1
- package/lib/cld-video-player.js +1 -1
- package/lib/cld-video-player.js.LICENSE.txt +16 -14
- package/lib/cld-video-player.min.css +2 -2
- package/lib/colors.js +2 -0
- package/lib/dash.js +1 -1
- package/lib/debug.js +1 -1
- package/lib/ima.js +1 -1
- package/lib/interaction-areas.js +1 -1
- package/lib/player.js +1 -1
- package/lib/player.js.LICENSE.txt +16 -14
- package/lib/playlist.js +1 -1
- package/lib/recommendations-overlay.js +1 -1
- package/lib/shoppable.js +1 -1
- package/lib/srt-text-tracks.js +2 -0
- package/lib/videoPlayer.js +1 -1
- package/lib/videoPlayer.js.LICENSE.txt +16 -14
- package/lib/visual-search.js +1 -1
- package/package.json +10 -23
- package/dist/chapters.light.js +0 -233
- package/dist/chapters.light.min.js +0 -2
- package/dist/cld-video-player.light.css +0 -2428
- package/dist/cld-video-player.light.min.css +0 -2
- package/dist/cld-video-player.light.min.js.LICENSE.txt +0 -21
- package/dist/cld-video-player.min.js.LICENSE.txt +0 -19
- package/dist/dash.light.js +0 -70036
- package/dist/dash.light.min.js +0 -3
- package/dist/dash.light.min.js.LICENSE.txt +0 -1842
- package/dist/dash.min.js.LICENSE.txt +0 -1842
- package/dist/debug.light.js +0 -383
- package/dist/debug.light.min.js +0 -2
- package/dist/ima.light.js +0 -7110
- package/dist/ima.light.min.js +0 -2
- package/dist/interaction-areas.light.js +0 -646
- package/dist/interaction-areas.light.min.js +0 -2
- package/dist/node_modules_lodash_throttle_js.light.js +0 -449
- package/dist/playlist.light.js +0 -1788
- package/dist/playlist.light.min.js +0 -2
- package/dist/recommendations-overlay.light.js +0 -464
- package/dist/recommendations-overlay.light.min.js +0 -2
- package/dist/shoppable.light.js +0 -853
- package/dist/shoppable.light.min.js +0 -2
- package/dist/visual-search.light.js +0 -317
- package/dist/visual-search.light.min.js +0 -2
- package/lib/light/chapters.js +0 -2
- package/lib/light/cld-video-player.light.min.css +0 -21
- package/lib/light/dash.js +0 -3
- package/lib/light/dash.js.LICENSE.txt +0 -1842
- package/lib/light/debug.js +0 -2
- package/lib/light/ima.js +0 -2
- package/lib/light/index.js +0 -3
- package/lib/light/index.js.LICENSE.txt +0 -21
- package/lib/light/interaction-areas.js +0 -2
- package/lib/light/playlist.js +0 -2
- package/lib/light/recommendations-overlay.js +0 -2
- package/lib/light/shoppable.js +0 -2
- package/lib/light/visual-search.js +0 -2
|
@@ -1,19 +1,21 @@
|
|
|
1
|
-
/*! @name @videojs/http-streaming @version 3.17.0 @license Apache-2.0 */
|
|
2
|
-
|
|
3
|
-
/*! @name aes-decrypter @version 4.0.2 @license Apache-2.0 */
|
|
4
|
-
|
|
5
|
-
/*! @name m3u8-parser @version 7.2.0 @license Apache-2.0 */
|
|
6
|
-
|
|
7
|
-
/*! @name pkcs7 @version 1.0.4 @license Apache-2.0 */
|
|
8
|
-
|
|
9
|
-
/*! @name videojs-contrib-quality-levels @version 4.1.0 @license Apache-2.0 */
|
|
10
|
-
|
|
11
1
|
/*! @name videojs-per-source-behaviors @version 3.0.1 @license Apache-2.0 */
|
|
12
2
|
|
|
3
|
+
/**
|
|
4
|
+
* @license
|
|
5
|
+
* slighly modified parse-headers 2.0.2 <https://github.com/kesla/parse-headers/>
|
|
6
|
+
* Copyright (c) 2014 David Björklund
|
|
7
|
+
* Available under the MIT license
|
|
8
|
+
* <https://github.com/kesla/parse-headers/blob/master/LICENCE>
|
|
9
|
+
*/
|
|
10
|
+
|
|
13
11
|
/**
|
|
14
12
|
* @license
|
|
15
|
-
*
|
|
16
|
-
* Copyright
|
|
17
|
-
* Available under
|
|
18
|
-
* <https://github.com/
|
|
13
|
+
* Video.js 8.23.3 <http://videojs.com/>
|
|
14
|
+
* Copyright Brightcove, Inc. <https://www.brightcove.com/>
|
|
15
|
+
* Available under Apache License Version 2.0
|
|
16
|
+
* <https://github.com/videojs/video.js/blob/main/LICENSE>
|
|
17
|
+
*
|
|
18
|
+
* Includes vtt.js <https://github.com/mozilla/vtt.js>
|
|
19
|
+
* Available under Apache License Version 2.0
|
|
20
|
+
* <https://github.com/mozilla/vtt.js/blob/main/LICENSE>
|
|
19
21
|
*/
|
package/lib/visual-search.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
(self.cloudinaryVideoPlayerChunkLoading=self.cloudinaryVideoPlayerChunkLoading||[]).push([[728],{9148:(e,a,s)=>{s.d(a,{default:()=>l});var t=s(
|
|
1
|
+
(self.cloudinaryVideoPlayerChunkLoading=self.cloudinaryVideoPlayerChunkLoading||[]).push([[728],{9148:(e,a,s)=>{s.d(a,{default:()=>l});var t=s(6673),r=s.n(t);const l=(e,a)=>{a.addClass("vjs-visual-search");let s=!1;const t=(e=>{const a=()=>{e.$$(".vjs-visual-search-marker").forEach((e=>e.remove())),e.$$(".vjs-visual-search-results-wrapper").forEach((e=>e.remove())),e.removeClass("vjs-visual-search-results-active")};return{displayResults:s=>{a();const t=e.duration(),l=e.controlBar.progressControl.seekBar,n=r().dom.createEl("div",{className:"vjs-visual-search-results-wrapper",role:"presentation"});s.forEach((a=>{const{start_time:s,end_time:l}=a,c=s/t*100,o=(l-s)/t*100,i=`${Math.floor(s/60)}:${Math.floor(s%60).toString().padStart(2,"0")}`,d=r().dom.createEl("div",{className:"vjs-control vjs-visual-search-marker",style:`left: ${c}%; width: ${o}%`,tabIndex:0,role:"button",title:`Search result at ${i}`,ariaLabel:`Search result at ${i}`});n.appendChild(d),d.addEventListener("click",(()=>{e.currentTime(s)})),d.addEventListener("keydown",(a=>{"Enter"!==a.key&&" "!==a.key||(a.preventDefault(),e.currentTime(s))}))})),l.el().appendChild(n),s.length>0&&e.addClass("vjs-visual-search-results-active")},clearMarkers:a}})(a),l=async e=>{const s=a.$(".vjs-visual-search-button");s.classList.add("vjs-waiting");try{const s=a.cloudinary.source(),r=s.publicId(),l=Object.assign({},s.transformation());l.flags=l.flags||[],l.flags.push(`getinfo:search_b64_${btoa(e)}`);const n=s.config().url(`${r}`,{transformation:l}),c=await fetch(n,{method:"GET",headers:{"Content-Type":"application/json"}});if(!c.ok)throw new Error(`Search request failed with status: ${c.status}`);const o=await c.json();t.displayResults(o.timestamps),o&&!a.hasStarted()&&a.play().then((()=>a.pause()))}catch(e){console.error("Error performing visual search:",e)}finally{s.classList.remove("vjs-waiting")}},n=()=>{s=!1,t.clearMarkers(),a.$(".vjs-visual-search-wrapper")?.remove()},c=()=>{n();const e=a.$(".vjs-title-bar");e&&e.classList.remove("vjs-hidden");const c=r().dom.createEl("div",{className:"vjs-visual-search-wrapper"}),o=()=>{s&&(s=!1,c.classList.remove("vjs-visual-search-active"),d.input.value="",d.input.tabIndex=-1,d.closeButton.tabIndex=-1,t.clearMarkers())},i=(e=>{const a=r().dom.createEl("button",{className:"vjs-control vjs-button vjs-visual-search-button",title:"Search video content",ariaLabel:"Search video content"}),t=r().dom.createEl("span",{className:"vjs-icon-search"});a.appendChild(t);const n=r().dom.createEl("span",{className:"vjs-loading-spinner"});return a.appendChild(n),a.addEventListener("click",(()=>{if(s){const e=d.input.value.trim();e&&l(e)}else s=!0,c.classList.add("vjs-visual-search-active"),d.input.tabIndex=0,d.closeButton.tabIndex=0,d.input.focus()})),a})(),d=((e,a)=>{const s=r().dom.createEl("form",{className:"vjs-visual-search-form"}),t=r().dom.createEl("input",{className:"vjs-visual-search-input",type:"text",ariaLabel:"Search input",tabIndex:-1}),l=r().dom.createEl("button",{className:"vjs-control vjs-button vjs-visual-search-close",type:"button",title:"Close search",ariaLabel:"Close search",tabIndex:-1}),n=r().dom.createEl("span",{className:"vjs-icon-close"});return l.appendChild(n),s.appendChild(t),s.appendChild(l),s.addEventListener("submit",(a=>{a.preventDefault();const s=t.value.trim();s&&e(s)})),l.addEventListener("click",(e=>{e.preventDefault(),a&&a()})),{element:s,input:t,closeButton:l}})(l,o);c.appendChild(i),c.appendChild(d.element),e.prepend(c),a.on("keydown",(e=>{"Escape"===e.key&&s&&o()}))};c(),a.visualSearch={createSearchUI:c,clearUI:n}}}}]);
|
|
2
2
|
//# sourceMappingURL=visual-search.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cloudinary-video-player",
|
|
3
|
-
"version": "2.6.1-edge.
|
|
3
|
+
"version": "2.6.1-edge.2",
|
|
4
4
|
"description": "Cloudinary Video Player",
|
|
5
5
|
"author": "Cloudinary",
|
|
6
6
|
"license": "MIT",
|
|
@@ -23,26 +23,18 @@
|
|
|
23
23
|
"require": "./dist/cld-video-player.min.js"
|
|
24
24
|
},
|
|
25
25
|
"./*": "./lib/*",
|
|
26
|
-
"./light":
|
|
27
|
-
"import": "./lib/light/index.js",
|
|
28
|
-
"require": "./dist/cld-video-player.light.min.js"
|
|
29
|
-
},
|
|
30
|
-
"./light/*": "./lib/light/*"
|
|
26
|
+
"./light/*": "./lib/*"
|
|
31
27
|
},
|
|
32
28
|
"scripts": {
|
|
33
29
|
"prepare": "shx cp env.example.js env.js",
|
|
34
30
|
"clean": "rm -rf dist lib",
|
|
35
31
|
"start": "webpack serve --config webpack/dev.config.js",
|
|
36
|
-
"start:light": "WEBPACK_BUILD_LIGHT=1 webpack serve --config webpack/dev.config.js",
|
|
37
32
|
"build": "WEBPACK_BUILD_MIN=1 webpack --config webpack/build.config.js --progress --color",
|
|
38
33
|
"build-dev": "webpack --config webpack/build.config.js --progress --color --mode=development",
|
|
39
34
|
"build-es": "WEBPACK_BUILD_MIN=1 webpack --config webpack/es6.config.js --progress --color",
|
|
40
|
-
"build-light": "
|
|
41
|
-
"build-
|
|
42
|
-
"build-light-es": "WEBPACK_BUILD_LIGHT=1 WEBPACK_BUILD_MIN=1 webpack --config webpack/es-light.config.js --progress --color",
|
|
43
|
-
"build-all": "npm run clean && npm run build && npm run build-dev && npm run build-light && npm run build-light-dev && npm run build-light-es && npm run build-es",
|
|
35
|
+
"build-light": "node webpack/copy-light-bundle.js",
|
|
36
|
+
"build-all": "npm run clean && npm run build && npm run build-dev && npm run build-es && npm run build-light",
|
|
44
37
|
"analyze": "webpack --config webpack/analyzer.config.js",
|
|
45
|
-
"analyze:light": "WEBPACK_BUILD_LIGHT=1 webpack --config webpack/analyzer.config.js",
|
|
46
38
|
"postbuild-all": "bundlewatch",
|
|
47
39
|
"precommit": "eslint src",
|
|
48
40
|
"test": "jest --no-cache --detectOpenHandles",
|
|
@@ -63,27 +55,19 @@
|
|
|
63
55
|
"files": [
|
|
64
56
|
{
|
|
65
57
|
"path": "./dist/cld-video-player.min.js",
|
|
66
|
-
"maxSize": "260kb"
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
"path": "./dist/cld-video-player.light.min.js",
|
|
70
58
|
"maxSize": "135kb"
|
|
71
59
|
},
|
|
72
60
|
{
|
|
73
61
|
"path": "./lib/cld-video-player.js",
|
|
74
|
-
"maxSize": "
|
|
62
|
+
"maxSize": "135kb"
|
|
75
63
|
},
|
|
76
64
|
{
|
|
77
65
|
"path": "./lib/videoPlayer.js",
|
|
78
|
-
"maxSize": "
|
|
66
|
+
"maxSize": "135kb"
|
|
79
67
|
},
|
|
80
68
|
{
|
|
81
69
|
"path": "./lib/all.js",
|
|
82
|
-
"maxSize": "
|
|
83
|
-
},
|
|
84
|
-
{
|
|
85
|
-
"path": "./lib/light/index.js",
|
|
86
|
-
"maxSize": "135kb"
|
|
70
|
+
"maxSize": "320kb"
|
|
87
71
|
}
|
|
88
72
|
]
|
|
89
73
|
},
|
|
@@ -91,12 +75,15 @@
|
|
|
91
75
|
"@cloudinary/url-gen": "^1.21.0",
|
|
92
76
|
"cloudinary-video-analytics": "1.8.2",
|
|
93
77
|
"cloudinary-video-player-profiles": "1.3.0",
|
|
78
|
+
"hls.js": "^1.6.2",
|
|
94
79
|
"lodash": "^4.17.21",
|
|
95
80
|
"srt-parser-2": "^1.2.3",
|
|
96
81
|
"uuid": "^11.0.3",
|
|
97
82
|
"video.js": "^8.23.3",
|
|
98
83
|
"videojs-contrib-ads": "^7.5.2",
|
|
99
84
|
"videojs-contrib-dash": "^5.1.1",
|
|
85
|
+
"videojs-contrib-quality-levels": "^4.1.0",
|
|
86
|
+
"videojs-contrib-quality-menu": "^1.0.4",
|
|
100
87
|
"videojs-ima": "^2.3.0",
|
|
101
88
|
"videojs-per-source-behaviors": "^3.0.1",
|
|
102
89
|
"webfontloader": "^1.6.28"
|
package/dist/chapters.light.js
DELETED
|
@@ -1,233 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
(self["cloudinaryVideoPlayerChunkLoading"] = self["cloudinaryVideoPlayerChunkLoading"] || []).push([["chapters"],{
|
|
3
|
-
|
|
4
|
-
/***/ "./plugins/chapters/chapters.js":
|
|
5
|
-
/*!**************************************!*\
|
|
6
|
-
!*** ./plugins/chapters/chapters.js ***!
|
|
7
|
-
\**************************************/
|
|
8
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
9
|
-
|
|
10
|
-
__webpack_require__.r(__webpack_exports__);
|
|
11
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
12
|
-
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
13
|
-
/* harmony export */ });
|
|
14
|
-
/* harmony import */ var video_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! video.js */ "../node_modules/video.js/dist/alt/video.core-exposed.js");
|
|
15
|
-
/* harmony import */ var video_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(video_js__WEBPACK_IMPORTED_MODULE_0__);
|
|
16
|
-
/* harmony import */ var _chapters_scss__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./chapters.scss */ "./plugins/chapters/chapters.scss");
|
|
17
|
-
/* harmony import */ var _cloudinary_common__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../cloudinary/common */ "./plugins/cloudinary/common.js");
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Chapters plugin.
|
|
24
|
-
*
|
|
25
|
-
* @function chapters
|
|
26
|
-
* @param {Object} [options={}]
|
|
27
|
-
* An object of options left to the plugin author to define.
|
|
28
|
-
* @param {Player} player
|
|
29
|
-
* A Video.js player object.
|
|
30
|
-
*/
|
|
31
|
-
const chapters = function chapters(options, player) {
|
|
32
|
-
player.addClass('vjs-chapters');
|
|
33
|
-
player.chapters = new ChaptersPlugin(player, options);
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* Chapters
|
|
38
|
-
*/
|
|
39
|
-
const ChaptersPlugin = function () {
|
|
40
|
-
/**
|
|
41
|
-
* Plugin class constructor, called by videojs on
|
|
42
|
-
* ready event.
|
|
43
|
-
*
|
|
44
|
-
* @function constructor
|
|
45
|
-
* @param {Player} player
|
|
46
|
-
* A Video.js player object.
|
|
47
|
-
*
|
|
48
|
-
* @param {Object} [options={}]
|
|
49
|
-
* A plain object containing options for the plugin.
|
|
50
|
-
*/
|
|
51
|
-
function ChaptersPlugin(player, options) {
|
|
52
|
-
this.player = player;
|
|
53
|
-
this.options = options;
|
|
54
|
-
this.player.one('loadedmetadata', this.initializeChapters.bind(this));
|
|
55
|
-
return this;
|
|
56
|
-
}
|
|
57
|
-
ChaptersPlugin.prototype.src = function src(options) {
|
|
58
|
-
this.resetPlugin();
|
|
59
|
-
this.options = options;
|
|
60
|
-
this.player.one('loadedmetadata', this.initializeChapters.bind(this));
|
|
61
|
-
};
|
|
62
|
-
ChaptersPlugin.prototype.detach = function detach() {
|
|
63
|
-
this.resetPlugin();
|
|
64
|
-
};
|
|
65
|
-
ChaptersPlugin.prototype.resetPlugin = function resetPlugin() {
|
|
66
|
-
if (this.chaptersTrack) {
|
|
67
|
-
this.player.$('.vjs-control-bar-chapter-display').remove();
|
|
68
|
-
this.player.$('.vjs-chapter-display').remove();
|
|
69
|
-
this.player.$$('.vjs-chapter-marker').forEach(el => el.remove());
|
|
70
|
-
this.player.removeRemoteTextTrack(this.chaptersTrack);
|
|
71
|
-
delete this.chaptersTrack;
|
|
72
|
-
}
|
|
73
|
-
};
|
|
74
|
-
ChaptersPlugin.prototype.getChaptersFileUrlByName = function getChaptersFileUrlByName() {
|
|
75
|
-
const currentPublicId = this.player.cloudinary.currentPublicId();
|
|
76
|
-
if (!currentPublicId) {
|
|
77
|
-
return null;
|
|
78
|
-
}
|
|
79
|
-
const fullUrl = (0,_cloudinary_common__WEBPACK_IMPORTED_MODULE_2__.getCloudinaryUrl)(`${currentPublicId}-chapters.vtt`, (0,_cloudinary_common__WEBPACK_IMPORTED_MODULE_2__.extendCloudinaryConfig)(this.player.cloudinary.cloudinaryConfig(), {
|
|
80
|
-
resource_type: 'raw',
|
|
81
|
-
version: '1'
|
|
82
|
-
}));
|
|
83
|
-
return `${fullUrl}?t=${Date.now()}`;
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
* Bootstrap the plugin.
|
|
88
|
-
*/
|
|
89
|
-
ChaptersPlugin.prototype.initializeChapters = async function initializeChapters() {
|
|
90
|
-
const chaptersUrl = this.options === true ? this.getChaptersFileUrlByName() : this.options.url;
|
|
91
|
-
if (chaptersUrl) {
|
|
92
|
-
// Fetch chapters VTT from URL
|
|
93
|
-
const chaptersTrack = {
|
|
94
|
-
kind: 'chapters',
|
|
95
|
-
src: chaptersUrl,
|
|
96
|
-
default: true
|
|
97
|
-
};
|
|
98
|
-
const textTrack = this.player.addRemoteTextTrack(chaptersTrack);
|
|
99
|
-
textTrack.addEventListener('load', () => {
|
|
100
|
-
this.chaptersTrack = textTrack.track;
|
|
101
|
-
this.setupChaptersDisplays();
|
|
102
|
-
});
|
|
103
|
-
} else if (Object.entries(this.options).length) {
|
|
104
|
-
// Setup chapters from options
|
|
105
|
-
const textTrack = this.player.addRemoteTextTrack({
|
|
106
|
-
kind: 'chapters',
|
|
107
|
-
default: true
|
|
108
|
-
});
|
|
109
|
-
const end = this.player.duration();
|
|
110
|
-
Object.entries(this.options).forEach((entry, index, arr) => {
|
|
111
|
-
const cue = new VTTCue(parseFloat(entry[0]), parseFloat(arr[index + 1] ? arr[index + 1][0] : end), entry[1]);
|
|
112
|
-
textTrack.track.addCue(cue);
|
|
113
|
-
});
|
|
114
|
-
this.chaptersTrack = textTrack.track;
|
|
115
|
-
this.setupChaptersDisplays();
|
|
116
|
-
if (this.player.controlBar.chaptersButton) {
|
|
117
|
-
this.player.controlBar.chaptersButton.update();
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
};
|
|
121
|
-
|
|
122
|
-
/**
|
|
123
|
-
* Setup chapter displays.
|
|
124
|
-
*/
|
|
125
|
-
ChaptersPlugin.prototype.setupChaptersDisplays = function initializeChapters() {
|
|
126
|
-
this.setupProgressBarMarkers();
|
|
127
|
-
this.setupProgressBarChapter();
|
|
128
|
-
this.setupControlBarChapter();
|
|
129
|
-
};
|
|
130
|
-
|
|
131
|
-
/**
|
|
132
|
-
* Setup the controlbar chapter display.
|
|
133
|
-
*/
|
|
134
|
-
ChaptersPlugin.prototype.setupControlBarChapter = function setupControlBarChapter() {
|
|
135
|
-
const controlBarChapterHolder = this.player.$('.vjs-control-bar-chapter-display') || document.createElement('div');
|
|
136
|
-
controlBarChapterHolder.setAttribute('class', 'vjs-control-bar-chapter-display');
|
|
137
|
-
const wrapper = this.player.$('.vjs-control-bar .vjs-spacer');
|
|
138
|
-
wrapper.innerHTML = '';
|
|
139
|
-
wrapper.classList.add('vjs-control-bar-chapter-wrapper');
|
|
140
|
-
wrapper.appendChild(controlBarChapterHolder);
|
|
141
|
-
this.chaptersTrack.addEventListener('cuechange', () => {
|
|
142
|
-
const activeCues = Array.from(this.chaptersTrack.activeCues); // Safari needs Array.from()
|
|
143
|
-
controlBarChapterHolder.innerText = activeCues.length > 0 ? activeCues[0].text : '';
|
|
144
|
-
});
|
|
145
|
-
};
|
|
146
|
-
|
|
147
|
-
/**
|
|
148
|
-
* Setup the progress bar markers.
|
|
149
|
-
*/
|
|
150
|
-
ChaptersPlugin.prototype.setupProgressBarMarkers = function setupProgressBarMarkers() {
|
|
151
|
-
const total = this.player.duration();
|
|
152
|
-
const {
|
|
153
|
-
seekBar
|
|
154
|
-
} = this.player.controlBar.progressControl;
|
|
155
|
-
Array.from(this.chaptersTrack.cues).forEach(marker => {
|
|
156
|
-
// Safari needs Array.from()
|
|
157
|
-
if (marker.startTime !== 0) {
|
|
158
|
-
const markerTime = marker.startTime;
|
|
159
|
-
const left = markerTime / total * 100 + '%';
|
|
160
|
-
const markerEl = video_js__WEBPACK_IMPORTED_MODULE_0___default().dom.createEl('div', undefined, {
|
|
161
|
-
class: 'vjs-chapter-marker',
|
|
162
|
-
style: `left: ${left}`
|
|
163
|
-
});
|
|
164
|
-
seekBar.el().append(markerEl);
|
|
165
|
-
}
|
|
166
|
-
});
|
|
167
|
-
};
|
|
168
|
-
|
|
169
|
-
/**
|
|
170
|
-
* Setup the progrees bar on-hover chapter display.
|
|
171
|
-
*/
|
|
172
|
-
ChaptersPlugin.prototype.setupProgressBarChapter = function setupProgressBarChapter() {
|
|
173
|
-
const chapterEl = video_js__WEBPACK_IMPORTED_MODULE_0___default().dom.createEl('div', undefined, {
|
|
174
|
-
class: 'vjs-chapter-display',
|
|
175
|
-
style: `max-width: ${this.player.$('.vjs-vtt-thumbnail-display') ? this.player.$('.vjs-vtt-thumbnail-display').style.width : '160px'}`
|
|
176
|
-
});
|
|
177
|
-
const mouseTimeDisplay = this.player.getDescendant(['controlBar', 'progressControl', 'seekBar', 'mouseTimeDisplay']);
|
|
178
|
-
const timeTooltip = mouseTimeDisplay.getDescendant(['timeTooltip']);
|
|
179
|
-
timeTooltip.el().parentElement.prepend(chapterEl);
|
|
180
|
-
const getChapterFromPoint = point => {
|
|
181
|
-
const total = this.player.duration();
|
|
182
|
-
const seekBarTime = point * total;
|
|
183
|
-
const chapter = Array.from(this.chaptersTrack?.cues || []).find(marker => {
|
|
184
|
-
return seekBarTime >= marker.startTime && seekBarTime <= marker.endTime;
|
|
185
|
-
});
|
|
186
|
-
return chapter ? chapter.text : '';
|
|
187
|
-
};
|
|
188
|
-
timeTooltip.update = function (seekBarRect, seekBarPoint, content) {
|
|
189
|
-
const originalUpdateFn = Object.getPrototypeOf(this).update;
|
|
190
|
-
originalUpdateFn.call(this, seekBarRect, seekBarPoint, content);
|
|
191
|
-
chapterEl.innerText = getChapterFromPoint(seekBarPoint);
|
|
192
|
-
};
|
|
193
|
-
|
|
194
|
-
// Handle case of no seek-thumbnails
|
|
195
|
-
if (typeof this.player.vttThumbnails !== 'object') {
|
|
196
|
-
mouseTimeDisplay.update = function (seekBarRect, seekBarPoint) {
|
|
197
|
-
const time = seekBarPoint * this.player_.duration();
|
|
198
|
-
const width = seekBarRect.width;
|
|
199
|
-
const size = chapterEl.clientWidth / 2;
|
|
200
|
-
timeTooltip.updateTime(seekBarRect, seekBarPoint, time, () => {
|
|
201
|
-
// Make sure it doesn't exit the player
|
|
202
|
-
if (seekBarRect.width * seekBarPoint < size) {
|
|
203
|
-
this.el_.style.left = `${size}px`;
|
|
204
|
-
} else if (seekBarRect.width * seekBarPoint + size > width) {
|
|
205
|
-
this.el_.style.left = `${seekBarRect.width - size}px`;
|
|
206
|
-
} else {
|
|
207
|
-
this.el_.style.left = `${seekBarRect.width * seekBarPoint}px`;
|
|
208
|
-
}
|
|
209
|
-
});
|
|
210
|
-
timeTooltip.write(video_js__WEBPACK_IMPORTED_MODULE_0___default().time.formatTime(time));
|
|
211
|
-
};
|
|
212
|
-
}
|
|
213
|
-
};
|
|
214
|
-
return ChaptersPlugin;
|
|
215
|
-
}();
|
|
216
|
-
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (chapters);
|
|
217
|
-
|
|
218
|
-
/***/ }),
|
|
219
|
-
|
|
220
|
-
/***/ "./plugins/chapters/chapters.scss":
|
|
221
|
-
/*!****************************************!*\
|
|
222
|
-
!*** ./plugins/chapters/chapters.scss ***!
|
|
223
|
-
\****************************************/
|
|
224
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
225
|
-
|
|
226
|
-
__webpack_require__.r(__webpack_exports__);
|
|
227
|
-
// extracted by mini-css-extract-plugin
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
/***/ })
|
|
231
|
-
|
|
232
|
-
}]);
|
|
233
|
-
//# sourceMappingURL=chapters.light.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";(self.cloudinaryVideoPlayerChunkLoading=self.cloudinaryVideoPlayerChunkLoading||[]).push([[625],{9234:(t,e,r)=>{r.d(e,{default:()=>n});var s=r(6673),a=r.n(s),i=r(9388);const o=function(){function t(t,e){return this.player=t,this.options=e,this.player.one("loadedmetadata",this.initializeChapters.bind(this)),this}return t.prototype.src=function(t){this.resetPlugin(),this.options=t,this.player.one("loadedmetadata",this.initializeChapters.bind(this))},t.prototype.detach=function(){this.resetPlugin()},t.prototype.resetPlugin=function(){this.chaptersTrack&&(this.player.$(".vjs-control-bar-chapter-display").remove(),this.player.$(".vjs-chapter-display").remove(),this.player.$$(".vjs-chapter-marker").forEach((t=>t.remove())),this.player.removeRemoteTextTrack(this.chaptersTrack),delete this.chaptersTrack)},t.prototype.getChaptersFileUrlByName=function(){const t=this.player.cloudinary.currentPublicId();if(!t)return null;return`${(0,i.KA)(`${t}-chapters.vtt`,(0,i.lP)(this.player.cloudinary.cloudinaryConfig(),{resource_type:"raw",version:"1"}))}?t=${Date.now()}`},t.prototype.initializeChapters=async function(){const t=!0===this.options?this.getChaptersFileUrlByName():this.options.url;if(t){const e={kind:"chapters",src:t,default:!0},r=this.player.addRemoteTextTrack(e);r.addEventListener("load",(()=>{this.chaptersTrack=r.track,this.setupChaptersDisplays()}))}else if(Object.entries(this.options).length){const t=this.player.addRemoteTextTrack({kind:"chapters",default:!0}),e=this.player.duration();Object.entries(this.options).forEach(((r,s,a)=>{const i=new VTTCue(parseFloat(r[0]),parseFloat(a[s+1]?a[s+1][0]:e),r[1]);t.track.addCue(i)})),this.chaptersTrack=t.track,this.setupChaptersDisplays(),this.player.controlBar.chaptersButton&&this.player.controlBar.chaptersButton.update()}},t.prototype.setupChaptersDisplays=function(){this.setupProgressBarMarkers(),this.setupProgressBarChapter(),this.setupControlBarChapter()},t.prototype.setupControlBarChapter=function(){const t=this.player.$(".vjs-control-bar-chapter-display")||document.createElement("div");t.setAttribute("class","vjs-control-bar-chapter-display");const e=this.player.$(".vjs-control-bar .vjs-spacer");e.innerHTML="",e.classList.add("vjs-control-bar-chapter-wrapper"),e.appendChild(t),this.chaptersTrack.addEventListener("cuechange",(()=>{const e=Array.from(this.chaptersTrack.activeCues);t.innerText=e.length>0?e[0].text:""}))},t.prototype.setupProgressBarMarkers=function(){const t=this.player.duration(),{seekBar:e}=this.player.controlBar.progressControl;Array.from(this.chaptersTrack.cues).forEach((r=>{if(0!==r.startTime){const s=r.startTime/t*100+"%",i=a().dom.createEl("div",void 0,{class:"vjs-chapter-marker",style:`left: ${s}`});e.el().append(i)}}))},t.prototype.setupProgressBarChapter=function(){const t=a().dom.createEl("div",void 0,{class:"vjs-chapter-display",style:`max-width: ${this.player.$(".vjs-vtt-thumbnail-display")?this.player.$(".vjs-vtt-thumbnail-display").style.width:"160px"}`}),e=this.player.getDescendant(["controlBar","progressControl","seekBar","mouseTimeDisplay"]),r=e.getDescendant(["timeTooltip"]);r.el().parentElement.prepend(t);const s=t=>{const e=t*this.player.duration(),r=Array.from(this.chaptersTrack?.cues||[]).find((t=>e>=t.startTime&&e<=t.endTime));return r?r.text:""};r.update=function(e,r,a){Object.getPrototypeOf(this).update.call(this,e,r,a),t.innerText=s(r)},"object"!=typeof this.player.vttThumbnails&&(e.update=function(e,s){const i=s*this.player_.duration(),o=e.width,n=t.clientWidth/2;r.updateTime(e,s,i,(()=>{e.width*s<n?this.el_.style.left=`${n}px`:e.width*s+n>o?this.el_.style.left=e.width-n+"px":this.el_.style.left=e.width*s+"px"})),r.write(a().time.formatTime(i))})},t}(),n=function(t,e){e.addClass("vjs-chapters"),e.chapters=new o(e,t)}}}]);
|
|
2
|
-
//# sourceMappingURL=chapters.light.min.js.map
|