@edm-webplayer/webplayer-angular 0.1.46 → 0.1.47
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.
|
@@ -148,9 +148,12 @@ class PlyrPlayerComponent {
|
|
|
148
148
|
});
|
|
149
149
|
}
|
|
150
150
|
getControlsSafeZone() {
|
|
151
|
-
const controls = (this.plyr?.elements?.controls ??
|
|
151
|
+
const controls = (this.plyr?.elements?.controls ??
|
|
152
|
+
null);
|
|
152
153
|
const menuHeight = this.getOpenMenuHeight();
|
|
153
|
-
const baseSafeZone = this.isTouchDevice()
|
|
154
|
+
const baseSafeZone = this.isTouchDevice()
|
|
155
|
+
? this.controlsSafeZonePxTouch
|
|
156
|
+
: this.controlsSafeZonePxDesktop;
|
|
154
157
|
if (!controls) {
|
|
155
158
|
return Math.max(baseSafeZone, menuHeight + 5);
|
|
156
159
|
}
|
|
@@ -169,8 +172,7 @@ class PlyrPlayerComponent {
|
|
|
169
172
|
}
|
|
170
173
|
getOverlaySafeZone() {
|
|
171
174
|
const host = this.config?.video_host;
|
|
172
|
-
if (this.overlayBlockAll &&
|
|
173
|
-
(host === 'youtube' || host === 'vimeo')) {
|
|
175
|
+
if (this.overlayBlockAll && (host === "youtube" || host === "vimeo")) {
|
|
174
176
|
if (this.playbackEnded) {
|
|
175
177
|
return 0;
|
|
176
178
|
}
|
|
@@ -196,7 +198,7 @@ class PlyrPlayerComponent {
|
|
|
196
198
|
}
|
|
197
199
|
ngAfterViewInit() {
|
|
198
200
|
this.setupPlayer();
|
|
199
|
-
window.addEventListener(
|
|
201
|
+
window.addEventListener("message", this.onCastMessage);
|
|
200
202
|
}
|
|
201
203
|
ngOnChanges(changes) {
|
|
202
204
|
if (changes["config"] && this.plyr) {
|
|
@@ -204,10 +206,10 @@ class PlyrPlayerComponent {
|
|
|
204
206
|
}
|
|
205
207
|
}
|
|
206
208
|
applyTheme(colors) {
|
|
207
|
-
const STYLE_ID =
|
|
209
|
+
const STYLE_ID = "webplayer-theme-vars";
|
|
208
210
|
let styleEl = this.document.getElementById(STYLE_ID);
|
|
209
211
|
if (!styleEl) {
|
|
210
|
-
styleEl = this.document.createElement(
|
|
212
|
+
styleEl = this.document.createElement("style");
|
|
211
213
|
styleEl.id = STYLE_ID;
|
|
212
214
|
this.document.head.appendChild(styleEl);
|
|
213
215
|
}
|
|
@@ -215,7 +217,7 @@ class PlyrPlayerComponent {
|
|
|
215
217
|
const allPairs = [];
|
|
216
218
|
for (const key in colors) {
|
|
217
219
|
if (Object.prototype.hasOwnProperty.call(colors, key)) {
|
|
218
|
-
const cssVarName = `--theme-${key.replace(
|
|
220
|
+
const cssVarName = `--theme-${key.replace("progresss-", "progress-")}`;
|
|
219
221
|
const cssVarValue = String(colors[key]);
|
|
220
222
|
allPairs.push([cssVarName, cssVarValue]);
|
|
221
223
|
try {
|
|
@@ -225,7 +227,7 @@ class PlyrPlayerComponent {
|
|
|
225
227
|
}
|
|
226
228
|
}
|
|
227
229
|
const cssRule = `:root{
|
|
228
|
-
${allPairs.map(([n, v]) => ` ${n}: ${v};`).join(
|
|
230
|
+
${allPairs.map(([n, v]) => ` ${n}: ${v};`).join("\n")}
|
|
229
231
|
}`;
|
|
230
232
|
styleEl.textContent = cssRule;
|
|
231
233
|
}
|
|
@@ -237,7 +239,7 @@ ${allPairs.map(([n, v]) => ` ${n}: ${v};`).join('\n')}
|
|
|
237
239
|
if (!candidate) {
|
|
238
240
|
return null;
|
|
239
241
|
}
|
|
240
|
-
return candidate.replace(/_/g,
|
|
242
|
+
return candidate.replace(/_/g, "-");
|
|
241
243
|
}
|
|
242
244
|
resolveLocale() {
|
|
243
245
|
const candidates = [
|
|
@@ -254,7 +256,7 @@ ${allPairs.map(([n, v]) => ` ${n}: ${v};`).join('\n')}
|
|
|
254
256
|
return normalized;
|
|
255
257
|
}
|
|
256
258
|
}
|
|
257
|
-
return
|
|
259
|
+
return "pt-BR";
|
|
258
260
|
}
|
|
259
261
|
resolveCaptionsLanguage(locale) {
|
|
260
262
|
const explicit = this.normalizeLocaleCandidate(this.config?.captions_locale ??
|
|
@@ -265,7 +267,7 @@ ${allPairs.map(([n, v]) => ` ${n}: ${v};`).join('\n')}
|
|
|
265
267
|
const baseLocale = explicit || locale;
|
|
266
268
|
if (!baseLocale)
|
|
267
269
|
return null;
|
|
268
|
-
const code = baseLocale.split(
|
|
270
|
+
const code = baseLocale.split("-")[0]?.trim();
|
|
269
271
|
return code ? code.toLowerCase() : null;
|
|
270
272
|
}
|
|
271
273
|
shouldHideVimeoRecommendations() {
|
|
@@ -304,7 +306,7 @@ ${allPairs.map(([n, v]) => ` ${n}: ${v};`).join('\n')}
|
|
|
304
306
|
if (!container)
|
|
305
307
|
return null;
|
|
306
308
|
const wrapper = this.plyr?.elements?.wrapper ||
|
|
307
|
-
container.querySelector(
|
|
309
|
+
container.querySelector(".plyr__video-wrapper");
|
|
308
310
|
return wrapper || null;
|
|
309
311
|
}
|
|
310
312
|
ensureRecommendationBlocker() {
|
|
@@ -314,30 +316,30 @@ ${allPairs.map(([n, v]) => ` ${n}: ${v};`).join('\n')}
|
|
|
314
316
|
const wrapper = this.getVideoWrapper();
|
|
315
317
|
if (!wrapper)
|
|
316
318
|
return null;
|
|
317
|
-
const blocker = this.document.createElement(
|
|
318
|
-
blocker.className =
|
|
319
|
-
blocker.style.position =
|
|
320
|
-
blocker.style.top =
|
|
321
|
-
blocker.style.left =
|
|
322
|
-
blocker.style.width =
|
|
323
|
-
blocker.style.height =
|
|
324
|
-
blocker.style.zIndex =
|
|
325
|
-
blocker.style.pointerEvents =
|
|
326
|
-
blocker.style.display =
|
|
327
|
-
blocker.style.background =
|
|
328
|
-
blocker.style.cursor =
|
|
329
|
-
const activeZone = this.document.createElement(
|
|
330
|
-
activeZone.className =
|
|
331
|
-
activeZone.style.position =
|
|
332
|
-
activeZone.style.top =
|
|
333
|
-
activeZone.style.left =
|
|
334
|
-
activeZone.style.width =
|
|
319
|
+
const blocker = this.document.createElement("div");
|
|
320
|
+
blocker.className = "plyr-recommendation-blocker";
|
|
321
|
+
blocker.style.position = "absolute";
|
|
322
|
+
blocker.style.top = "0";
|
|
323
|
+
blocker.style.left = "0";
|
|
324
|
+
blocker.style.width = "100%";
|
|
325
|
+
blocker.style.height = "100%";
|
|
326
|
+
blocker.style.zIndex = "11";
|
|
327
|
+
blocker.style.pointerEvents = "none";
|
|
328
|
+
blocker.style.display = "none";
|
|
329
|
+
blocker.style.background = "rgba(0,0,0,0)";
|
|
330
|
+
blocker.style.cursor = "pointer";
|
|
331
|
+
const activeZone = this.document.createElement("div");
|
|
332
|
+
activeZone.className = "plyr-recommendation-blocker__zone";
|
|
333
|
+
activeZone.style.position = "absolute";
|
|
334
|
+
activeZone.style.top = "0";
|
|
335
|
+
activeZone.style.left = "0";
|
|
336
|
+
activeZone.style.width = "100%";
|
|
335
337
|
activeZone.style.bottom = `20px`;
|
|
336
|
-
activeZone.style.pointerEvents =
|
|
337
|
-
activeZone.style.background =
|
|
338
|
-
activeZone.style.cursor =
|
|
339
|
-
activeZone.addEventListener(
|
|
340
|
-
activeZone.addEventListener(
|
|
338
|
+
activeZone.style.pointerEvents = "auto";
|
|
339
|
+
activeZone.style.background = "rgba(0,0,0,0)";
|
|
340
|
+
activeZone.style.cursor = "pointer";
|
|
341
|
+
activeZone.addEventListener("pointerdown", this.onTopBlockerPointerDown);
|
|
342
|
+
activeZone.addEventListener("click", this.onRecommendationBlockerClick);
|
|
341
343
|
blocker.appendChild(activeZone);
|
|
342
344
|
wrapper.appendChild(blocker);
|
|
343
345
|
this.recommendationBlocker = blocker;
|
|
@@ -346,7 +348,8 @@ ${allPairs.map(([n, v]) => ` ${n}: ${v};`).join('\n')}
|
|
|
346
348
|
return blocker;
|
|
347
349
|
}
|
|
348
350
|
toggleRecommendationBlocker(active) {
|
|
349
|
-
if (this.config.video_host !== "youtube" &&
|
|
351
|
+
if (this.config.video_host !== "youtube" &&
|
|
352
|
+
this.config.video_host !== "vimeo") {
|
|
350
353
|
return;
|
|
351
354
|
}
|
|
352
355
|
const blocker = this.ensureRecommendationBlocker();
|
|
@@ -354,18 +357,18 @@ ${allPairs.map(([n, v]) => ` ${n}: ${v};`).join('\n')}
|
|
|
354
357
|
return;
|
|
355
358
|
const activeZone = this.recommendationBlockerActiveZone;
|
|
356
359
|
if (active) {
|
|
357
|
-
blocker.style.display =
|
|
358
|
-
blocker.style.pointerEvents =
|
|
360
|
+
blocker.style.display = "block";
|
|
361
|
+
blocker.style.pointerEvents = "none";
|
|
359
362
|
if (activeZone) {
|
|
360
|
-
activeZone.style.pointerEvents =
|
|
363
|
+
activeZone.style.pointerEvents = "auto";
|
|
361
364
|
}
|
|
362
365
|
this.updateRecommendationBlockerSafeZone();
|
|
363
366
|
}
|
|
364
367
|
else {
|
|
365
|
-
blocker.style.display =
|
|
366
|
-
blocker.style.pointerEvents =
|
|
368
|
+
blocker.style.display = "none";
|
|
369
|
+
blocker.style.pointerEvents = "none";
|
|
367
370
|
if (activeZone) {
|
|
368
|
-
activeZone.style.pointerEvents =
|
|
371
|
+
activeZone.style.pointerEvents = "none";
|
|
369
372
|
}
|
|
370
373
|
}
|
|
371
374
|
this.updateTopClickBlockerSafeZone();
|
|
@@ -380,33 +383,33 @@ ${allPairs.map(([n, v]) => ` ${n}: ${v};`).join('\n')}
|
|
|
380
383
|
updateTopClickBlockerSafeZone(precomputed) {
|
|
381
384
|
if (!this.topClickBlocker)
|
|
382
385
|
return;
|
|
383
|
-
const safeZoneRaw = typeof precomputed ===
|
|
386
|
+
const safeZoneRaw = typeof precomputed === "number" ? precomputed : this.getOverlaySafeZone();
|
|
384
387
|
const safeZone = Math.max(0, safeZoneRaw);
|
|
385
388
|
this.topClickBlocker.style.bottom = `${safeZone}px`;
|
|
386
389
|
}
|
|
387
390
|
togglePlayback(force) {
|
|
388
391
|
if (!this.plyr)
|
|
389
392
|
return;
|
|
390
|
-
const hasTogglePlay = typeof this.plyr.togglePlay ===
|
|
393
|
+
const hasTogglePlay = typeof this.plyr.togglePlay === "function";
|
|
391
394
|
const ended = this.playbackEnded;
|
|
392
|
-
if (hasTogglePlay && typeof force ===
|
|
395
|
+
if (hasTogglePlay && typeof force === "undefined") {
|
|
393
396
|
try {
|
|
394
397
|
const result = this.plyr.togglePlay();
|
|
395
|
-
if (result && typeof result.catch ===
|
|
398
|
+
if (result && typeof result.catch === "function") {
|
|
396
399
|
result.catch(() => { });
|
|
397
400
|
}
|
|
398
401
|
return;
|
|
399
402
|
}
|
|
400
403
|
catch { }
|
|
401
404
|
}
|
|
402
|
-
const shouldPlay = typeof force ===
|
|
405
|
+
const shouldPlay = typeof force === "boolean" ? !!force : !this.plyr.playing;
|
|
403
406
|
if (shouldPlay) {
|
|
404
407
|
if (this.deferUntilStartTimeSettles(() => this.togglePlayback(true))) {
|
|
405
408
|
return;
|
|
406
409
|
}
|
|
407
410
|
if (ended) {
|
|
408
411
|
try {
|
|
409
|
-
if (typeof this.plyr.restart ===
|
|
412
|
+
if (typeof this.plyr.restart === "function") {
|
|
410
413
|
this.plyr.restart();
|
|
411
414
|
}
|
|
412
415
|
else {
|
|
@@ -420,7 +423,7 @@ ${allPairs.map(([n, v]) => ` ${n}: ${v};`).join('\n')}
|
|
|
420
423
|
this.updateRecommendationBlockerSafeZone();
|
|
421
424
|
try {
|
|
422
425
|
const result = this.plyr.play?.();
|
|
423
|
-
if (result && typeof result.catch ===
|
|
426
|
+
if (result && typeof result.catch === "function") {
|
|
424
427
|
result.catch(() => { });
|
|
425
428
|
}
|
|
426
429
|
}
|
|
@@ -435,7 +438,8 @@ ${allPairs.map(([n, v]) => ` ${n}: ${v};`).join('\n')}
|
|
|
435
438
|
catch { }
|
|
436
439
|
}
|
|
437
440
|
ensureTopClickBlocker() {
|
|
438
|
-
if (this.config.video_host !== "youtube" &&
|
|
441
|
+
if (this.config.video_host !== "youtube" &&
|
|
442
|
+
this.config.video_host !== "vimeo") {
|
|
439
443
|
return;
|
|
440
444
|
}
|
|
441
445
|
const wrapper = this.getVideoWrapper();
|
|
@@ -444,20 +448,20 @@ ${allPairs.map(([n, v]) => ` ${n}: ${v};`).join('\n')}
|
|
|
444
448
|
if (this.topClickBlocker && this.topClickBlocker.isConnected) {
|
|
445
449
|
return;
|
|
446
450
|
}
|
|
447
|
-
const blocker = this.document.createElement(
|
|
448
|
-
blocker.className =
|
|
449
|
-
blocker.style.position =
|
|
450
|
-
blocker.style.top =
|
|
451
|
-
blocker.style.left =
|
|
452
|
-
blocker.style.right =
|
|
453
|
-
blocker.style.width =
|
|
454
|
-
blocker.style.zIndex =
|
|
455
|
-
blocker.style.pointerEvents =
|
|
456
|
-
blocker.style.background =
|
|
457
|
-
blocker.style.touchAction =
|
|
458
|
-
blocker.style.cursor =
|
|
459
|
-
blocker.addEventListener(
|
|
460
|
-
blocker.addEventListener(
|
|
451
|
+
const blocker = this.document.createElement("div");
|
|
452
|
+
blocker.className = "plyr-top-click-blocker";
|
|
453
|
+
blocker.style.position = "absolute";
|
|
454
|
+
blocker.style.top = "0";
|
|
455
|
+
blocker.style.left = "0";
|
|
456
|
+
blocker.style.right = "0";
|
|
457
|
+
blocker.style.width = "100%";
|
|
458
|
+
blocker.style.zIndex = "12";
|
|
459
|
+
blocker.style.pointerEvents = "auto";
|
|
460
|
+
blocker.style.background = "rgba(0,0,0,0)";
|
|
461
|
+
blocker.style.touchAction = "none";
|
|
462
|
+
blocker.style.cursor = "pointer";
|
|
463
|
+
blocker.addEventListener("pointerdown", this.onTopBlockerPointerDown);
|
|
464
|
+
blocker.addEventListener("click", this.onTopBlockerClick);
|
|
461
465
|
wrapper.appendChild(blocker);
|
|
462
466
|
this.topClickBlocker = blocker;
|
|
463
467
|
this.updateTopClickBlockerSafeZone();
|
|
@@ -475,56 +479,52 @@ ${allPairs.map(([n, v]) => ` ${n}: ${v};`).join('\n')}
|
|
|
475
479
|
observer.observe(container, {
|
|
476
480
|
subtree: true,
|
|
477
481
|
attributes: true,
|
|
478
|
-
attributeFilter: [
|
|
482
|
+
attributeFilter: ["aria-hidden", "class", "style"],
|
|
479
483
|
});
|
|
480
484
|
this.menuObserver = observer;
|
|
481
485
|
}
|
|
482
486
|
isIOSDevice() {
|
|
483
|
-
if (typeof navigator ===
|
|
487
|
+
if (typeof navigator === "undefined")
|
|
484
488
|
return false;
|
|
485
|
-
const ua = navigator.userAgent ||
|
|
489
|
+
const ua = navigator.userAgent || "";
|
|
486
490
|
const iOS = /iPad|iPhone|iPod/.test(ua);
|
|
487
|
-
const iPadOS = navigator.platform ===
|
|
491
|
+
const iPadOS = navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1;
|
|
488
492
|
return iOS || iPadOS;
|
|
489
493
|
}
|
|
490
|
-
isAndroidDevice() {
|
|
491
|
-
if (typeof navigator === 'undefined')
|
|
492
|
-
return false;
|
|
493
|
-
return /Android/i.test(navigator.userAgent || '');
|
|
494
|
-
}
|
|
495
494
|
isTouchDevice() {
|
|
496
|
-
if (typeof window ===
|
|
495
|
+
if (typeof window === "undefined") {
|
|
497
496
|
return false;
|
|
498
497
|
}
|
|
499
|
-
if (typeof navigator !==
|
|
498
|
+
if (typeof navigator !== "undefined" && navigator.maxTouchPoints > 0) {
|
|
500
499
|
return true;
|
|
501
500
|
}
|
|
502
501
|
if (window.matchMedia) {
|
|
503
502
|
try {
|
|
504
|
-
if (window.matchMedia(
|
|
503
|
+
if (window.matchMedia("(pointer: coarse)").matches) {
|
|
505
504
|
return true;
|
|
506
505
|
}
|
|
507
506
|
}
|
|
508
507
|
catch { }
|
|
509
508
|
}
|
|
510
|
-
return
|
|
509
|
+
return "ontouchstart" in window;
|
|
511
510
|
}
|
|
512
511
|
isIframeProvider() {
|
|
513
|
-
return this.config?.video_host ===
|
|
512
|
+
return (this.config?.video_host === "youtube" ||
|
|
513
|
+
this.config?.video_host === "vimeo");
|
|
514
514
|
}
|
|
515
515
|
shouldDisableAutoplayForIOS() {
|
|
516
516
|
return this.isIOSDevice();
|
|
517
517
|
}
|
|
518
518
|
shouldDisableAutoplayForVimeo() {
|
|
519
|
-
return this.isIOSDevice() && this.config?.video_host ===
|
|
519
|
+
return this.isIOSDevice() && this.config?.video_host === "vimeo";
|
|
520
520
|
}
|
|
521
521
|
shouldResetProgressToBeginning() {
|
|
522
522
|
const host = this.config?.video_host;
|
|
523
|
-
if (host !==
|
|
523
|
+
if (host !== "youtube" && host !== "vimeo") {
|
|
524
524
|
return false;
|
|
525
525
|
}
|
|
526
526
|
const seenFlag = this.config?.seen;
|
|
527
|
-
if (seenFlag === true || seenFlag ===
|
|
527
|
+
if (seenFlag === true || seenFlag === "true" || seenFlag === 1) {
|
|
528
528
|
return true;
|
|
529
529
|
}
|
|
530
530
|
const rawPercent = this.config?.last_percent;
|
|
@@ -544,7 +544,8 @@ ${allPairs.map(([n, v]) => ` ${n}: ${v};`).join('\n')}
|
|
|
544
544
|
return !!(this.config?.autoplay || this.config?.is_live);
|
|
545
545
|
}
|
|
546
546
|
shouldAutoplay() {
|
|
547
|
-
if (this.shouldDisableAutoplayForIOS() ||
|
|
547
|
+
if (this.shouldDisableAutoplayForIOS() ||
|
|
548
|
+
this.shouldDisableAutoplayForVimeo()) {
|
|
548
549
|
return false;
|
|
549
550
|
}
|
|
550
551
|
return this.wantsAutoplay();
|
|
@@ -556,7 +557,7 @@ ${allPairs.map(([n, v]) => ` ${n}: ${v};`).join('\n')}
|
|
|
556
557
|
return this.wantsAutoplay();
|
|
557
558
|
}
|
|
558
559
|
shouldBlockIframeAutoplay() {
|
|
559
|
-
return this.shouldDisableAutoplayForIOS() || this.shouldDisableAutoplayForVimeo();
|
|
560
|
+
return (this.shouldDisableAutoplayForIOS() || this.shouldDisableAutoplayForVimeo());
|
|
560
561
|
}
|
|
561
562
|
stopRestrictedIframeAutoplay() {
|
|
562
563
|
if (!this.shouldBlockIframeAutoplay()) {
|
|
@@ -585,7 +586,7 @@ ${allPairs.map(([n, v]) => ` ${n}: ${v};`).join('\n')}
|
|
|
585
586
|
}
|
|
586
587
|
catch { }
|
|
587
588
|
try {
|
|
588
|
-
if (typeof this.plyr.pause ===
|
|
589
|
+
if (typeof this.plyr.pause === "function") {
|
|
589
590
|
this.plyr.pause();
|
|
590
591
|
}
|
|
591
592
|
}
|
|
@@ -594,13 +595,13 @@ ${allPairs.map(([n, v]) => ` ${n}: ${v};`).join('\n')}
|
|
|
594
595
|
const embed = this.plyr?.embed;
|
|
595
596
|
if (embed) {
|
|
596
597
|
try {
|
|
597
|
-
if (typeof embed.pause ===
|
|
598
|
+
if (typeof embed.pause === "function") {
|
|
598
599
|
embed.pause();
|
|
599
600
|
}
|
|
600
|
-
if (typeof embed.setMuted ===
|
|
601
|
+
if (typeof embed.setMuted === "function") {
|
|
601
602
|
embed.setMuted(false);
|
|
602
603
|
}
|
|
603
|
-
if (typeof embed.setVolume ===
|
|
604
|
+
if (typeof embed.setVolume === "function") {
|
|
604
605
|
embed.setVolume(1);
|
|
605
606
|
}
|
|
606
607
|
}
|
|
@@ -608,7 +609,7 @@ ${allPairs.map(([n, v]) => ` ${n}: ${v};`).join('\n')}
|
|
|
608
609
|
}
|
|
609
610
|
}
|
|
610
611
|
enforceVimeoVolumeAfterPlay(video) {
|
|
611
|
-
if (this.config?.video_host !==
|
|
612
|
+
if (this.config?.video_host !== "vimeo") {
|
|
612
613
|
return;
|
|
613
614
|
}
|
|
614
615
|
const media = video ?? this.videoRef?.nativeElement ?? null;
|
|
@@ -617,13 +618,13 @@ ${allPairs.map(([n, v]) => ` ${n}: ${v};`).join('\n')}
|
|
|
617
618
|
this.setPlayerMutedState(false, volumeTarget, media);
|
|
618
619
|
const currentEmbed = this.plyr?.embed;
|
|
619
620
|
if (currentEmbed) {
|
|
620
|
-
if (typeof currentEmbed.setMuted ===
|
|
621
|
+
if (typeof currentEmbed.setMuted === "function") {
|
|
621
622
|
try {
|
|
622
623
|
currentEmbed.setMuted(false);
|
|
623
624
|
}
|
|
624
625
|
catch { }
|
|
625
626
|
}
|
|
626
|
-
if (typeof currentEmbed.setVolume ===
|
|
627
|
+
if (typeof currentEmbed.setVolume === "function") {
|
|
627
628
|
try {
|
|
628
629
|
currentEmbed.setVolume(volumeTarget);
|
|
629
630
|
}
|
|
@@ -654,7 +655,7 @@ ${allPairs.map(([n, v]) => ` ${n}: ${v};`).join('\n')}
|
|
|
654
655
|
media.muted = muted;
|
|
655
656
|
}
|
|
656
657
|
catch { }
|
|
657
|
-
if (!muted && typeof media.volume ===
|
|
658
|
+
if (!muted && typeof media.volume === "number") {
|
|
658
659
|
try {
|
|
659
660
|
media.volume = volume;
|
|
660
661
|
}
|
|
@@ -672,7 +673,7 @@ ${allPairs.map(([n, v]) => ` ${n}: ${v};`).join('\n')}
|
|
|
672
673
|
}
|
|
673
674
|
}
|
|
674
675
|
ensureAutoplayUnlockListener() {
|
|
675
|
-
if (typeof window ===
|
|
676
|
+
if (typeof window === "undefined" ||
|
|
676
677
|
this.interactionUnmuteCleanup ||
|
|
677
678
|
!this.shouldAutoplay()) {
|
|
678
679
|
return;
|
|
@@ -686,13 +687,13 @@ ${allPairs.map(([n, v]) => ` ${n}: ${v};`).join('\n')}
|
|
|
686
687
|
catch { }
|
|
687
688
|
this.clearAutoplayUnlockListener();
|
|
688
689
|
};
|
|
689
|
-
window.addEventListener(
|
|
690
|
-
window.addEventListener(
|
|
691
|
-
window.addEventListener(
|
|
690
|
+
window.addEventListener("touchend", handler, capture);
|
|
691
|
+
window.addEventListener("pointerup", handler, capture);
|
|
692
|
+
window.addEventListener("click", handler, capture);
|
|
692
693
|
this.interactionUnmuteCleanup = () => {
|
|
693
|
-
window.removeEventListener(
|
|
694
|
-
window.removeEventListener(
|
|
695
|
-
window.removeEventListener(
|
|
694
|
+
window.removeEventListener("touchend", handler, capture);
|
|
695
|
+
window.removeEventListener("pointerup", handler, capture);
|
|
696
|
+
window.removeEventListener("click", handler, capture);
|
|
696
697
|
this.interactionUnmuteCleanup = undefined;
|
|
697
698
|
};
|
|
698
699
|
}
|
|
@@ -703,22 +704,28 @@ ${allPairs.map(([n, v]) => ` ${n}: ${v};`).join('\n')}
|
|
|
703
704
|
const container = this.plyr?.elements?.container;
|
|
704
705
|
if (!container)
|
|
705
706
|
return;
|
|
706
|
-
const iframe = container.querySelector(
|
|
707
|
+
const iframe = container.querySelector("iframe") ?? null;
|
|
707
708
|
if (!iframe)
|
|
708
709
|
return;
|
|
709
|
-
const allowRaw = iframe.getAttribute(
|
|
710
|
+
const allowRaw = iframe.getAttribute("allow") || "";
|
|
710
711
|
const tokens = new Set(allowRaw
|
|
711
|
-
.split(
|
|
712
|
+
.split(";")
|
|
712
713
|
.map((token) => token.trim())
|
|
713
714
|
.filter(Boolean));
|
|
714
|
-
[
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
iframe.setAttribute(
|
|
715
|
+
[
|
|
716
|
+
"autoplay",
|
|
717
|
+
"fullscreen",
|
|
718
|
+
"encrypted-media",
|
|
719
|
+
"picture-in-picture",
|
|
720
|
+
"gyroscope",
|
|
721
|
+
].forEach((rule) => tokens.add(rule));
|
|
722
|
+
iframe.setAttribute("allow", Array.from(tokens).join("; "));
|
|
723
|
+
if (this.config.video_host === "youtube") {
|
|
724
|
+
iframe.setAttribute("playsinline", "1");
|
|
725
|
+
iframe.setAttribute("webkit-playsinline", "1");
|
|
726
|
+
}
|
|
727
|
+
iframe.setAttribute("allowfullscreen", "true");
|
|
728
|
+
iframe.setAttribute("data-keepplaying", "true");
|
|
722
729
|
}
|
|
723
730
|
scheduleUserInteractionUnmute(video) {
|
|
724
731
|
this.unmuteAfterDelay(video || undefined);
|
|
@@ -796,7 +803,7 @@ ${allPairs.map(([n, v]) => ` ${n}: ${v};`).join('\n')}
|
|
|
796
803
|
let maybePromise = null;
|
|
797
804
|
try {
|
|
798
805
|
const result = this.seekUsingHostAPI(start, video);
|
|
799
|
-
if (result && typeof result.then ===
|
|
806
|
+
if (result && typeof result.then === "function") {
|
|
800
807
|
maybePromise = result;
|
|
801
808
|
}
|
|
802
809
|
}
|
|
@@ -818,9 +825,9 @@ ${allPairs.map(([n, v]) => ` ${n}: ${v};`).join('\n')}
|
|
|
818
825
|
if (!Number.isFinite(target) || target < 0) {
|
|
819
826
|
return null;
|
|
820
827
|
}
|
|
821
|
-
if (this.config.video_host ===
|
|
828
|
+
if (this.config.video_host === "vimeo") {
|
|
822
829
|
const embed = this.plyr?.embed;
|
|
823
|
-
if (embed && typeof embed.setCurrentTime ===
|
|
830
|
+
if (embed && typeof embed.setCurrentTime === "function") {
|
|
824
831
|
try {
|
|
825
832
|
return embed.setCurrentTime(target);
|
|
826
833
|
}
|
|
@@ -863,7 +870,7 @@ ${allPairs.map(([n, v]) => ` ${n}: ${v};`).join('\n')}
|
|
|
863
870
|
if (media) {
|
|
864
871
|
try {
|
|
865
872
|
const nativePlay = media.play();
|
|
866
|
-
if (nativePlay && typeof nativePlay.catch ===
|
|
873
|
+
if (nativePlay && typeof nativePlay.catch === "function") {
|
|
867
874
|
nativePlay.catch(() => { });
|
|
868
875
|
}
|
|
869
876
|
}
|
|
@@ -872,7 +879,8 @@ ${allPairs.map(([n, v]) => ` ${n}: ${v};`).join('\n')}
|
|
|
872
879
|
this.scheduleUserInteractionUnmute(media);
|
|
873
880
|
return;
|
|
874
881
|
}
|
|
875
|
-
if (playResult &&
|
|
882
|
+
if (playResult &&
|
|
883
|
+
typeof playResult.catch === "function") {
|
|
876
884
|
playResult.catch((error) => {
|
|
877
885
|
if (!muted) {
|
|
878
886
|
tryPlay(true);
|
|
@@ -881,7 +889,7 @@ ${allPairs.map(([n, v]) => ` ${n}: ${v};`).join('\n')}
|
|
|
881
889
|
if (media) {
|
|
882
890
|
try {
|
|
883
891
|
const nativePlay = media.play();
|
|
884
|
-
if (nativePlay && typeof nativePlay.catch ===
|
|
892
|
+
if (nativePlay && typeof nativePlay.catch === "function") {
|
|
885
893
|
nativePlay.catch(() => { });
|
|
886
894
|
}
|
|
887
895
|
}
|
|
@@ -912,16 +920,16 @@ ${allPairs.map(([n, v]) => ` ${n}: ${v};`).join('\n')}
|
|
|
912
920
|
const embed = this.plyr?.embed;
|
|
913
921
|
if (!embed)
|
|
914
922
|
return;
|
|
915
|
-
if (this.config.video_host ===
|
|
916
|
-
if (typeof embed.playVideo ===
|
|
923
|
+
if (this.config.video_host === "youtube") {
|
|
924
|
+
if (typeof embed.playVideo === "function") {
|
|
917
925
|
try {
|
|
918
926
|
embed.playVideo();
|
|
919
927
|
}
|
|
920
928
|
catch { }
|
|
921
929
|
}
|
|
922
930
|
}
|
|
923
|
-
else if (this.config.video_host ===
|
|
924
|
-
if (typeof embed.play ===
|
|
931
|
+
else if (this.config.video_host === "vimeo") {
|
|
932
|
+
if (typeof embed.play === "function") {
|
|
925
933
|
try {
|
|
926
934
|
embed.play();
|
|
927
935
|
}
|
|
@@ -945,11 +953,11 @@ ${allPairs.map(([n, v]) => ` ${n}: ${v};`).join('\n')}
|
|
|
945
953
|
}
|
|
946
954
|
};
|
|
947
955
|
const showControls = () => {
|
|
948
|
-
container.classList.remove(
|
|
956
|
+
container.classList.remove("plyr--auto-hide-controls");
|
|
949
957
|
};
|
|
950
958
|
const hideControls = () => {
|
|
951
959
|
if (this.plyr?.playing) {
|
|
952
|
-
container.classList.add(
|
|
960
|
+
container.classList.add("plyr--auto-hide-controls");
|
|
953
961
|
}
|
|
954
962
|
};
|
|
955
963
|
const scheduleHide = () => {
|
|
@@ -966,7 +974,7 @@ ${allPairs.map(([n, v]) => ` ${n}: ${v};`).join('\n')}
|
|
|
966
974
|
clearHideTimeout();
|
|
967
975
|
showControls();
|
|
968
976
|
if (this.isIOSDevice()) {
|
|
969
|
-
console.log(
|
|
977
|
+
console.log("event: ended");
|
|
970
978
|
}
|
|
971
979
|
};
|
|
972
980
|
const onEnded = () => {
|
|
@@ -977,19 +985,19 @@ ${allPairs.map(([n, v]) => ` ${n}: ${v};`).join('\n')}
|
|
|
977
985
|
showControls();
|
|
978
986
|
scheduleHide();
|
|
979
987
|
};
|
|
980
|
-
this.plyr?.on?.(
|
|
981
|
-
this.plyr?.on?.(
|
|
982
|
-
this.plyr?.on?.(
|
|
983
|
-
container.addEventListener(
|
|
984
|
-
container.addEventListener(
|
|
988
|
+
this.plyr?.on?.("play", onPlay);
|
|
989
|
+
this.plyr?.on?.("pause", onPause);
|
|
990
|
+
this.plyr?.on?.("ended", onEnded);
|
|
991
|
+
container.addEventListener("touchstart", onUserInteraction);
|
|
992
|
+
container.addEventListener("click", onUserInteraction);
|
|
985
993
|
this.controlsVisibilityCleanup = () => {
|
|
986
994
|
clearHideTimeout();
|
|
987
|
-
this.plyr?.off?.(
|
|
988
|
-
this.plyr?.off?.(
|
|
989
|
-
this.plyr?.off?.(
|
|
990
|
-
container.removeEventListener(
|
|
991
|
-
container.removeEventListener(
|
|
992
|
-
container.classList.remove(
|
|
995
|
+
this.plyr?.off?.("play", onPlay);
|
|
996
|
+
this.plyr?.off?.("pause", onPause);
|
|
997
|
+
this.plyr?.off?.("ended", onEnded);
|
|
998
|
+
container.removeEventListener("touchstart", onUserInteraction);
|
|
999
|
+
container.removeEventListener("click", onUserInteraction);
|
|
1000
|
+
container.classList.remove("plyr--auto-hide-controls");
|
|
993
1001
|
};
|
|
994
1002
|
onPlay();
|
|
995
1003
|
return;
|
|
@@ -998,10 +1006,10 @@ ${allPairs.map(([n, v]) => ` ${n}: ${v};`).join('\n')}
|
|
|
998
1006
|
const toggleClass = () => {
|
|
999
1007
|
const playing = !!this.plyr?.playing;
|
|
1000
1008
|
if (playing && !hovering) {
|
|
1001
|
-
container.classList.add(
|
|
1009
|
+
container.classList.add("plyr--auto-hide-controls");
|
|
1002
1010
|
}
|
|
1003
1011
|
else {
|
|
1004
|
-
container.classList.remove(
|
|
1012
|
+
container.classList.remove("plyr--auto-hide-controls");
|
|
1005
1013
|
}
|
|
1006
1014
|
};
|
|
1007
1015
|
const onPlay = () => toggleClass();
|
|
@@ -1020,39 +1028,39 @@ ${allPairs.map(([n, v]) => ` ${n}: ${v};`).join('\n')}
|
|
|
1020
1028
|
toggleClass();
|
|
1021
1029
|
};
|
|
1022
1030
|
const onFocusOut = () => {
|
|
1023
|
-
hovering = container.matches(
|
|
1031
|
+
hovering = container.matches(":hover");
|
|
1024
1032
|
toggleClass();
|
|
1025
1033
|
};
|
|
1026
|
-
this.plyr?.on?.(
|
|
1027
|
-
this.plyr?.on?.(
|
|
1028
|
-
this.plyr?.on?.(
|
|
1029
|
-
container.addEventListener(
|
|
1030
|
-
container.addEventListener(
|
|
1031
|
-
container.addEventListener(
|
|
1032
|
-
container.addEventListener(
|
|
1034
|
+
this.plyr?.on?.("play", onPlay);
|
|
1035
|
+
this.plyr?.on?.("pause", onPause);
|
|
1036
|
+
this.plyr?.on?.("ended", onEnded);
|
|
1037
|
+
container.addEventListener("mouseenter", onMouseEnter);
|
|
1038
|
+
container.addEventListener("mouseleave", onMouseLeave);
|
|
1039
|
+
container.addEventListener("focusin", onFocusIn);
|
|
1040
|
+
container.addEventListener("focusout", onFocusOut);
|
|
1033
1041
|
toggleClass();
|
|
1034
1042
|
this.controlsVisibilityCleanup = () => {
|
|
1035
|
-
this.plyr?.off?.(
|
|
1036
|
-
this.plyr?.off?.(
|
|
1037
|
-
this.plyr?.off?.(
|
|
1038
|
-
container.removeEventListener(
|
|
1039
|
-
container.removeEventListener(
|
|
1040
|
-
container.removeEventListener(
|
|
1041
|
-
container.removeEventListener(
|
|
1042
|
-
container.classList.remove(
|
|
1043
|
+
this.plyr?.off?.("play", onPlay);
|
|
1044
|
+
this.plyr?.off?.("pause", onPause);
|
|
1045
|
+
this.plyr?.off?.("ended", onEnded);
|
|
1046
|
+
container.removeEventListener("mouseenter", onMouseEnter);
|
|
1047
|
+
container.removeEventListener("mouseleave", onMouseLeave);
|
|
1048
|
+
container.removeEventListener("focusin", onFocusIn);
|
|
1049
|
+
container.removeEventListener("focusout", onFocusOut);
|
|
1050
|
+
container.classList.remove("plyr--auto-hide-controls");
|
|
1043
1051
|
};
|
|
1044
1052
|
}
|
|
1045
1053
|
bindFullscreenBehavior() {
|
|
1046
1054
|
const onEnterFullscreen = () => {
|
|
1047
|
-
console.log(
|
|
1055
|
+
console.log("event: enterfullscreen");
|
|
1048
1056
|
parent.postMessage("event: fullscreen_enter', '*'");
|
|
1049
1057
|
};
|
|
1050
1058
|
const onExitFullscreen = () => {
|
|
1051
|
-
console.log(
|
|
1059
|
+
console.log("event: exitfullscreen");
|
|
1052
1060
|
parent.postMessage("event: fullscreen_exit', '*'");
|
|
1053
1061
|
};
|
|
1054
|
-
this.plyr.on(
|
|
1055
|
-
this.plyr.on(
|
|
1062
|
+
this.plyr.on("enterfullscreen", onEnterFullscreen);
|
|
1063
|
+
this.plyr.on("exitfullscreen", onExitFullscreen);
|
|
1056
1064
|
}
|
|
1057
1065
|
setupPlayer() {
|
|
1058
1066
|
if (!this.videoRef)
|
|
@@ -1065,7 +1073,7 @@ ${allPairs.map(([n, v]) => ` ${n}: ${v};`).join('\n')}
|
|
|
1065
1073
|
this.recommendationBlocker = null;
|
|
1066
1074
|
const speedOptions = [1, 1.25, 1.5, 2];
|
|
1067
1075
|
const locale = this.resolveLocale();
|
|
1068
|
-
const captionsLanguage = this.resolveCaptionsLanguage(locale) ??
|
|
1076
|
+
const captionsLanguage = this.resolveCaptionsLanguage(locale) ?? "pt";
|
|
1069
1077
|
const hideVimeoRecommendations = this.shouldHideVimeoRecommendations();
|
|
1070
1078
|
const vimeoPremium = Boolean(this.config?.vimeo_premium);
|
|
1071
1079
|
const shouldAutoplay = this.shouldAutoplay();
|
|
@@ -1075,7 +1083,8 @@ ${allPairs.map(([n, v]) => ` ${n}: ${v};`).join('\n')}
|
|
|
1075
1083
|
}
|
|
1076
1084
|
catch { }
|
|
1077
1085
|
try {
|
|
1078
|
-
this.videoRef.nativeElement.playsInline =
|
|
1086
|
+
this.videoRef.nativeElement.playsInline =
|
|
1087
|
+
this.config?.video_host === "youtube";
|
|
1079
1088
|
}
|
|
1080
1089
|
catch { }
|
|
1081
1090
|
try {
|
|
@@ -1089,7 +1098,7 @@ ${allPairs.map(([n, v]) => ` ${n}: ${v};`).join('\n')}
|
|
|
1089
1098
|
};
|
|
1090
1099
|
youtubePlayerVars.playerVars = {
|
|
1091
1100
|
hl: locale,
|
|
1092
|
-
cc_lang_pref: captionsLanguage || locale.split(
|
|
1101
|
+
cc_lang_pref: captionsLanguage || locale.split("-")[0]?.toLowerCase(),
|
|
1093
1102
|
autoplay: shouldAutoplay ? 1 : 0,
|
|
1094
1103
|
mute: startMuted ? 1 : 0,
|
|
1095
1104
|
playsinline: 1,
|
|
@@ -1119,11 +1128,11 @@ ${allPairs.map(([n, v]) => ` ${n}: ${v};`).join('\n')}
|
|
|
1119
1128
|
container: null,
|
|
1120
1129
|
},
|
|
1121
1130
|
i18n: {
|
|
1122
|
-
speed:
|
|
1131
|
+
speed: "Velocidade",
|
|
1123
1132
|
},
|
|
1124
1133
|
speed: {
|
|
1125
1134
|
selected: 1,
|
|
1126
|
-
options: speedOptions
|
|
1135
|
+
options: speedOptions,
|
|
1127
1136
|
},
|
|
1128
1137
|
clickToPlay: true,
|
|
1129
1138
|
hideControls: false,
|
|
@@ -1135,7 +1144,7 @@ ${allPairs.map(([n, v]) => ` ${n}: ${v};`).join('\n')}
|
|
|
1135
1144
|
if (captionsLanguage) {
|
|
1136
1145
|
plyrOptions.captions = { language: captionsLanguage };
|
|
1137
1146
|
}
|
|
1138
|
-
if (this.config.video_host ===
|
|
1147
|
+
if (this.config.video_host === "youtube") {
|
|
1139
1148
|
plyrOptions.youtube = youtubePlayerVars;
|
|
1140
1149
|
}
|
|
1141
1150
|
this.plyr = new Plyr.default(this.videoRef.nativeElement, plyrOptions);
|
|
@@ -1145,8 +1154,8 @@ ${allPairs.map(([n, v]) => ` ${n}: ${v};`).join('\n')}
|
|
|
1145
1154
|
this.observeMenuChanges();
|
|
1146
1155
|
this.playbackEnded = false;
|
|
1147
1156
|
this.overlayBlockAll = false;
|
|
1148
|
-
window.removeEventListener(
|
|
1149
|
-
window.addEventListener(
|
|
1157
|
+
window.removeEventListener("resize", this.onResize);
|
|
1158
|
+
window.addEventListener("resize", this.onResize);
|
|
1150
1159
|
this.bindProgressEvents();
|
|
1151
1160
|
this.loadSource(this.videoRef.nativeElement).then(() => {
|
|
1152
1161
|
this.setupStartTime();
|
|
@@ -1174,7 +1183,11 @@ ${allPairs.map(([n, v]) => ` ${n}: ${v};`).join('\n')}
|
|
|
1174
1183
|
const t = this.plyr.currentTime || 0;
|
|
1175
1184
|
const d = this.plyr.duration || 0;
|
|
1176
1185
|
const p = d > 0 ? +((t / d) * 100).toFixed(2) : 0;
|
|
1177
|
-
this.progressService.progress$.next({
|
|
1186
|
+
this.progressService.progress$.next({
|
|
1187
|
+
currentTime: t,
|
|
1188
|
+
duration: d,
|
|
1189
|
+
percent: p,
|
|
1190
|
+
});
|
|
1178
1191
|
};
|
|
1179
1192
|
const onTimeUpdate = () => {
|
|
1180
1193
|
const now = performance.now();
|
|
@@ -1182,11 +1195,11 @@ ${allPairs.map(([n, v]) => ` ${n}: ${v};`).join('\n')}
|
|
|
1182
1195
|
lastEmit = now;
|
|
1183
1196
|
emitProgress();
|
|
1184
1197
|
}
|
|
1185
|
-
parent.postMessage(
|
|
1186
|
-
console.log(
|
|
1187
|
-
console.log(
|
|
1198
|
+
parent.postMessage("currentTime:" + (this.plyr.currentTime || 0), "*");
|
|
1199
|
+
console.log("event: current_time " + (this.plyr.currentTime || 0));
|
|
1200
|
+
console.log("event: duration " + this.plyr.duration);
|
|
1188
1201
|
this.postCastEvent({
|
|
1189
|
-
event:
|
|
1202
|
+
event: "current_time",
|
|
1190
1203
|
currentTime: this.plyr.currentTime || 0,
|
|
1191
1204
|
duration: this.plyr.duration || 0,
|
|
1192
1205
|
});
|
|
@@ -1199,16 +1212,21 @@ ${allPairs.map(([n, v]) => ` ${n}: ${v};`).join('\n')}
|
|
|
1199
1212
|
this.updateRecommendationBlockerSafeZone();
|
|
1200
1213
|
this.toggleRecommendationBlocker(false);
|
|
1201
1214
|
this.enforceVimeoVolumeAfterPlay();
|
|
1202
|
-
parent.postMessage(
|
|
1203
|
-
|
|
1204
|
-
|
|
1215
|
+
parent.postMessage("playing_video", "*");
|
|
1216
|
+
this.postCastEvent({
|
|
1217
|
+
event: "play",
|
|
1218
|
+
currentTime: this.plyr.currentTime || 0,
|
|
1219
|
+
});
|
|
1205
1220
|
});
|
|
1206
1221
|
this.plyr?.on?.("timeupdate", onTimeUpdate);
|
|
1207
1222
|
this.plyr?.on?.("pause", () => {
|
|
1208
1223
|
emitProgress();
|
|
1209
|
-
console.log(
|
|
1210
|
-
parent.postMessage(
|
|
1211
|
-
this.postCastEvent({
|
|
1224
|
+
console.log("event: pause");
|
|
1225
|
+
parent.postMessage("paused_video", "*");
|
|
1226
|
+
this.postCastEvent({
|
|
1227
|
+
event: "pause",
|
|
1228
|
+
currentTime: this.plyr.currentTime || 0,
|
|
1229
|
+
});
|
|
1212
1230
|
this.overlayBlockAll = true;
|
|
1213
1231
|
this.updateRecommendationBlockerSafeZone();
|
|
1214
1232
|
this.toggleRecommendationBlocker(true);
|
|
@@ -1218,9 +1236,12 @@ ${allPairs.map(([n, v]) => ` ${n}: ${v};`).join('\n')}
|
|
|
1218
1236
|
this.playbackEnded = true;
|
|
1219
1237
|
this.overlayBlockAll = true;
|
|
1220
1238
|
this.updateRecommendationBlockerSafeZone();
|
|
1221
|
-
console.log(
|
|
1222
|
-
parent.postMessage(
|
|
1223
|
-
this.postCastEvent({
|
|
1239
|
+
console.log("event: ended");
|
|
1240
|
+
parent.postMessage("event: ended", "*");
|
|
1241
|
+
this.postCastEvent({
|
|
1242
|
+
event: "ended",
|
|
1243
|
+
currentTime: this.plyr.currentTime || 0,
|
|
1244
|
+
});
|
|
1224
1245
|
this.progressService.ended$.next();
|
|
1225
1246
|
this.preventVimeoRecommendations();
|
|
1226
1247
|
this.toggleRecommendationBlocker(true);
|
|
@@ -1249,7 +1270,7 @@ ${allPairs.map(([n, v]) => ` ${n}: ${v};`).join('\n')}
|
|
|
1249
1270
|
}
|
|
1250
1271
|
resetPlaybackRate(video) {
|
|
1251
1272
|
try {
|
|
1252
|
-
if (this.plyr && typeof this.plyr.speed !==
|
|
1273
|
+
if (this.plyr && typeof this.plyr.speed !== "undefined") {
|
|
1253
1274
|
this.plyr.speed = 1;
|
|
1254
1275
|
}
|
|
1255
1276
|
}
|
|
@@ -1278,7 +1299,8 @@ ${allPairs.map(([n, v]) => ` ${n}: ${v};`).join('\n')}
|
|
|
1278
1299
|
this.hls = undefined;
|
|
1279
1300
|
}
|
|
1280
1301
|
this.resetPlaybackRate(video);
|
|
1281
|
-
if (this.config.video_host === "youtube" ||
|
|
1302
|
+
if (this.config.video_host === "youtube" ||
|
|
1303
|
+
this.config.video_host === "vimeo") {
|
|
1282
1304
|
const onReady = () => {
|
|
1283
1305
|
this.plyr.off("ready", onReady);
|
|
1284
1306
|
this.ensureIframeAutoplayPermissions();
|
|
@@ -1290,20 +1312,20 @@ ${allPairs.map(([n, v]) => ` ${n}: ${v};`).join('\n')}
|
|
|
1290
1312
|
else if (this.shouldBlockIframeAutoplay()) {
|
|
1291
1313
|
this.stopRestrictedIframeAutoplay();
|
|
1292
1314
|
}
|
|
1293
|
-
parent.postMessage(
|
|
1294
|
-
parent.postMessage(
|
|
1295
|
-
console.log(
|
|
1296
|
-
console.log(
|
|
1297
|
-
console.log(
|
|
1315
|
+
parent.postMessage("playerIsReadyToPlay", "*");
|
|
1316
|
+
parent.postMessage("duration:" + this.plyr.duration, "*");
|
|
1317
|
+
console.log("event: current_time " + this.plyr.currentTime);
|
|
1318
|
+
console.log("event: duration " + this.plyr.duration);
|
|
1319
|
+
console.log("event: ready");
|
|
1298
1320
|
this.postCastEvent({
|
|
1299
|
-
event:
|
|
1321
|
+
event: "ready",
|
|
1300
1322
|
duration: this.plyr.duration || 0,
|
|
1301
1323
|
currentTime: this.plyr.currentTime || 0,
|
|
1302
1324
|
});
|
|
1303
1325
|
if (this.config.is_live) {
|
|
1304
|
-
this.plyr?.on(
|
|
1305
|
-
console.log(
|
|
1306
|
-
parent.postMessage(
|
|
1326
|
+
this.plyr?.on("playing", function () {
|
|
1327
|
+
console.log("event: playing_live");
|
|
1328
|
+
parent.postMessage("event: playing_live", "*");
|
|
1307
1329
|
});
|
|
1308
1330
|
}
|
|
1309
1331
|
if (this.config.mirror) {
|
|
@@ -1337,10 +1359,10 @@ ${allPairs.map(([n, v]) => ` ${n}: ${v};`).join('\n')}
|
|
|
1337
1359
|
else if (this.config.video_host === "hls") {
|
|
1338
1360
|
let sourceX = "";
|
|
1339
1361
|
try {
|
|
1340
|
-
sourceX = atob(this.config.video_id ||
|
|
1362
|
+
sourceX = atob(this.config.video_id || "");
|
|
1341
1363
|
}
|
|
1342
1364
|
catch (e) {
|
|
1343
|
-
sourceX = this.config.video_id ||
|
|
1365
|
+
sourceX = this.config.video_id || "";
|
|
1344
1366
|
}
|
|
1345
1367
|
const canNative = video.canPlayType("application/vnd.apple.mpegurl");
|
|
1346
1368
|
if (canNative) {
|
|
@@ -1423,7 +1445,9 @@ ${allPairs.map(([n, v]) => ` ${n}: ${v};`).join('\n')}
|
|
|
1423
1445
|
if (hasTime) {
|
|
1424
1446
|
return clamp(last_time);
|
|
1425
1447
|
}
|
|
1426
|
-
const hasPercent = last_percent !== undefined &&
|
|
1448
|
+
const hasPercent = last_percent !== undefined &&
|
|
1449
|
+
last_percent !== null &&
|
|
1450
|
+
last_percent !== "";
|
|
1427
1451
|
if (hasPercent && hasValidDuration) {
|
|
1428
1452
|
let p = Number(last_percent);
|
|
1429
1453
|
if (!isFinite(p) || p < 0)
|
|
@@ -1444,30 +1468,32 @@ ${allPairs.map(([n, v]) => ` ${n}: ${v};`).join('\n')}
|
|
|
1444
1468
|
return 0;
|
|
1445
1469
|
}
|
|
1446
1470
|
postCastEvent(payload) {
|
|
1447
|
-
parent.postMessage(JSON.stringify(payload),
|
|
1471
|
+
parent.postMessage(JSON.stringify(payload), "*");
|
|
1448
1472
|
}
|
|
1449
1473
|
onCastMessage = (evt) => {
|
|
1450
1474
|
let data = evt.data;
|
|
1451
|
-
if (typeof data ===
|
|
1475
|
+
if (typeof data === "string") {
|
|
1452
1476
|
try {
|
|
1453
1477
|
data = JSON.parse(data);
|
|
1454
1478
|
}
|
|
1455
|
-
catch {
|
|
1479
|
+
catch {
|
|
1480
|
+
/* ignora */
|
|
1481
|
+
}
|
|
1456
1482
|
}
|
|
1457
|
-
if (data?.action ===
|
|
1483
|
+
if (data?.action === "request-iframe-media-metadata") {
|
|
1458
1484
|
this.postCastEvent({
|
|
1459
|
-
event:
|
|
1485
|
+
event: "metadata",
|
|
1460
1486
|
duration: this.plyr?.duration || 0,
|
|
1461
1487
|
currentTime: this.plyr?.currentTime || 0,
|
|
1462
1488
|
});
|
|
1463
1489
|
}
|
|
1464
|
-
if (data?.action ===
|
|
1490
|
+
if (data?.action === "play") {
|
|
1465
1491
|
this.plyr?.play();
|
|
1466
1492
|
}
|
|
1467
|
-
if (data?.action ===
|
|
1493
|
+
if (data?.action === "pause") {
|
|
1468
1494
|
this.plyr?.pause();
|
|
1469
1495
|
}
|
|
1470
|
-
if (data?.action ===
|
|
1496
|
+
if (data?.action === "seek" && typeof data.time === "number") {
|
|
1471
1497
|
this.plyr && (this.plyr.currentTime = data.time);
|
|
1472
1498
|
}
|
|
1473
1499
|
};
|
|
@@ -1486,8 +1512,8 @@ ${allPairs.map(([n, v]) => ` ${n}: ${v};`).join('\n')}
|
|
|
1486
1512
|
}
|
|
1487
1513
|
if (this.recommendationBlockerActiveZone) {
|
|
1488
1514
|
try {
|
|
1489
|
-
this.recommendationBlockerActiveZone.removeEventListener(
|
|
1490
|
-
this.recommendationBlockerActiveZone.removeEventListener(
|
|
1515
|
+
this.recommendationBlockerActiveZone.removeEventListener("pointerdown", this.onTopBlockerPointerDown);
|
|
1516
|
+
this.recommendationBlockerActiveZone.removeEventListener("click", this.onRecommendationBlockerClick);
|
|
1491
1517
|
}
|
|
1492
1518
|
catch { }
|
|
1493
1519
|
}
|
|
@@ -1495,8 +1521,8 @@ ${allPairs.map(([n, v]) => ` ${n}: ${v};`).join('\n')}
|
|
|
1495
1521
|
this.recommendationBlockerActiveZone = null;
|
|
1496
1522
|
if (this.topClickBlocker?.parentElement) {
|
|
1497
1523
|
try {
|
|
1498
|
-
this.topClickBlocker.removeEventListener(
|
|
1499
|
-
this.topClickBlocker.removeEventListener(
|
|
1524
|
+
this.topClickBlocker.removeEventListener("pointerdown", this.onTopBlockerPointerDown);
|
|
1525
|
+
this.topClickBlocker.removeEventListener("click", this.onTopBlockerClick);
|
|
1500
1526
|
this.topClickBlocker.parentElement.removeChild(this.topClickBlocker);
|
|
1501
1527
|
}
|
|
1502
1528
|
catch { }
|
|
@@ -1504,16 +1530,16 @@ ${allPairs.map(([n, v]) => ` ${n}: ${v};`).join('\n')}
|
|
|
1504
1530
|
this.topClickBlocker = null;
|
|
1505
1531
|
this.menuObserver?.disconnect();
|
|
1506
1532
|
this.menuObserver = undefined;
|
|
1507
|
-
window.removeEventListener(
|
|
1533
|
+
window.removeEventListener("resize", this.onResize);
|
|
1508
1534
|
this.plyr?.destroy();
|
|
1509
|
-
window.removeEventListener(
|
|
1535
|
+
window.removeEventListener("message", this.onCastMessage);
|
|
1510
1536
|
}
|
|
1511
1537
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: PlyrPlayerComponent, deps: [{ token: WebplayerProgressService }, { token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Component });
|
|
1512
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.14", type: PlyrPlayerComponent, isStandalone: true, selector: "app-plyr-player", inputs: { config: "config" }, outputs: { ready: "ready" }, viewQueries: [{ propertyName: "videoRef", first: true, predicate: ["video"], descendants: true, static: true }], usesOnChanges: true, ngImport: i0, template: `<video #video playsinline></video>`, isInline: true, styles: [":host{display:block;width:100%;height:100%;position:relative;--plyr-color-main: var(--theme-alert, #19a6d9);--plyr-color-hover: var(--theme-alert, #2dbbff);--plyr-progress-buffer-background: var(--theme-progress-view-off, rgba(255, 255, 255, .25));--plyr-control-background: var(--theme-bg, rgba(0, 0, 0, .8));--plyr-control-color: var(--theme-text-color, #fff);--plyr-control-button-color: var(--theme-font-bt, #fff)}:host ::ng-deep .plyr__controls{color:var(--plyr-control-color)!important;transition:opacity .2s ease,transform .2s ease}:host ::ng-deep .plyr__controls button{color:var(--plyr-control-color)!important}:host ::ng-deep .plyr__progress__buffer{background-color:var(--plyr-progress-buffer-background)!important}:host ::ng-deep .plyr,:host ::ng-deep .plyr__video-wrapper,:host ::ng-deep .plyr__video-embed,:host ::ng-deep .plyr__video-embed>iframe,:host ::ng-deep video{width:100%!important;height:100%!important;aspect-ratio:auto!important;top:0!important;left:0!important}:host ::ng-deep .mirror{transform:scaleX(-1)!important;-webkit-transform:scaleX(-1)!important}:host ::ng-deep .plyr--video .plyr__control.plyr__tab-focus,:host ::ng-deep .plyr--video .plyr__control:hover,:host ::ng-deep .plyr--video .plyr__control[aria-expanded=true]{background:var(--plyr-color-hover)!important;color:var(--plyr-control-button-color)!important}:host ::ng-deep .plyr--full-ui input[type=range]{color:var(--plyr-color-main)!important}:host ::ng-deep .plyr__menu__container .plyr__control[role=menuitemradio][aria-checked=true]:before{background:var(--plyr-color-main)!important}:host ::ng-deep .plyr__menu__container{background:var(--plyr-control-background)!important;z-index:7!important}:host ::ng-deep .plyr--auto-hide-controls .plyr__controls{opacity:0!important;pointer-events:none!important;transform:translateY(12px)}:host ::ng-deep .ytp-more-videos-view .ytp-suggestions{pointer-events:none!important}:host ::ng-deep .plyr--vimeo .plyr__video-wrapper.plyr__video-embed{aspect-ratio:16 / 9!important;width:100%!important;height:auto!important}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }] });
|
|
1538
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.14", type: PlyrPlayerComponent, isStandalone: true, selector: "app-plyr-player", inputs: { config: "config" }, outputs: { ready: "ready" }, viewQueries: [{ propertyName: "videoRef", first: true, predicate: ["video"], descendants: true, static: true }], usesOnChanges: true, ngImport: i0, template: `<video #video playsinline></video>`, isInline: true, styles: [":host{display:block;width:100%;height:100%;position:relative;--plyr-color-main: var(--theme-alert, #19a6d9);--plyr-color-hover: var(--theme-alert, #2dbbff);--plyr-progress-buffer-background: var( --theme-progress-view-off, rgba(255, 255, 255, .25) );--plyr-control-background: var(--theme-bg, rgba(0, 0, 0, .8));--plyr-control-color: var(--theme-text-color, #fff);--plyr-control-button-color: var(--theme-font-bt, #fff)}:host ::ng-deep .plyr__controls{color:var(--plyr-control-color)!important;transition:opacity .2s ease,transform .2s ease}:host ::ng-deep .plyr__controls button{color:var(--plyr-control-color)!important}:host ::ng-deep .plyr__progress__buffer{background-color:var(--plyr-progress-buffer-background)!important}:host ::ng-deep .plyr,:host ::ng-deep .plyr__video-wrapper,:host ::ng-deep .plyr__video-embed,:host ::ng-deep .plyr__video-embed>iframe,:host ::ng-deep video{width:100%!important;height:100%!important;aspect-ratio:auto!important;top:0!important;left:0!important}:host ::ng-deep .mirror{transform:scaleX(-1)!important;-webkit-transform:scaleX(-1)!important}:host ::ng-deep .plyr--video .plyr__control.plyr__tab-focus,:host ::ng-deep .plyr--video .plyr__control:hover,:host ::ng-deep .plyr--video .plyr__control[aria-expanded=true]{background:var(--plyr-color-hover)!important;color:var(--plyr-control-button-color)!important}:host ::ng-deep .plyr--full-ui input[type=range]{color:var(--plyr-color-main)!important}:host ::ng-deep .plyr__menu__container .plyr__control[role=menuitemradio][aria-checked=true]:before{background:var(--plyr-color-main)!important}:host ::ng-deep .plyr__menu__container{background:var(--plyr-control-background)!important;z-index:7!important}:host ::ng-deep .plyr--auto-hide-controls .plyr__controls{opacity:0!important;pointer-events:none!important;transform:translateY(12px)}:host ::ng-deep .ytp-more-videos-view .ytp-suggestions{pointer-events:none!important}:host ::ng-deep .plyr--vimeo .plyr__video-wrapper.plyr__video-embed{aspect-ratio:16 / 9!important;width:100%!important;height:auto!important}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }] });
|
|
1513
1539
|
}
|
|
1514
1540
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: PlyrPlayerComponent, decorators: [{
|
|
1515
1541
|
type: Component,
|
|
1516
|
-
args: [{ selector: "app-plyr-player", template: `<video #video playsinline></video>`, standalone: true, imports: [CommonModule], styles: [":host{display:block;width:100%;height:100%;position:relative;--plyr-color-main: var(--theme-alert, #19a6d9);--plyr-color-hover: var(--theme-alert, #2dbbff);--plyr-progress-buffer-background: var(--theme-progress-view-off, rgba(255, 255, 255, .25));--plyr-control-background: var(--theme-bg, rgba(0, 0, 0, .8));--plyr-control-color: var(--theme-text-color, #fff);--plyr-control-button-color: var(--theme-font-bt, #fff)}:host ::ng-deep .plyr__controls{color:var(--plyr-control-color)!important;transition:opacity .2s ease,transform .2s ease}:host ::ng-deep .plyr__controls button{color:var(--plyr-control-color)!important}:host ::ng-deep .plyr__progress__buffer{background-color:var(--plyr-progress-buffer-background)!important}:host ::ng-deep .plyr,:host ::ng-deep .plyr__video-wrapper,:host ::ng-deep .plyr__video-embed,:host ::ng-deep .plyr__video-embed>iframe,:host ::ng-deep video{width:100%!important;height:100%!important;aspect-ratio:auto!important;top:0!important;left:0!important}:host ::ng-deep .mirror{transform:scaleX(-1)!important;-webkit-transform:scaleX(-1)!important}:host ::ng-deep .plyr--video .plyr__control.plyr__tab-focus,:host ::ng-deep .plyr--video .plyr__control:hover,:host ::ng-deep .plyr--video .plyr__control[aria-expanded=true]{background:var(--plyr-color-hover)!important;color:var(--plyr-control-button-color)!important}:host ::ng-deep .plyr--full-ui input[type=range]{color:var(--plyr-color-main)!important}:host ::ng-deep .plyr__menu__container .plyr__control[role=menuitemradio][aria-checked=true]:before{background:var(--plyr-color-main)!important}:host ::ng-deep .plyr__menu__container{background:var(--plyr-control-background)!important;z-index:7!important}:host ::ng-deep .plyr--auto-hide-controls .plyr__controls{opacity:0!important;pointer-events:none!important;transform:translateY(12px)}:host ::ng-deep .ytp-more-videos-view .ytp-suggestions{pointer-events:none!important}:host ::ng-deep .plyr--vimeo .plyr__video-wrapper.plyr__video-embed{aspect-ratio:16 / 9!important;width:100%!important;height:auto!important}\n"] }]
|
|
1542
|
+
args: [{ selector: "app-plyr-player", template: `<video #video playsinline></video>`, standalone: true, imports: [CommonModule], styles: [":host{display:block;width:100%;height:100%;position:relative;--plyr-color-main: var(--theme-alert, #19a6d9);--plyr-color-hover: var(--theme-alert, #2dbbff);--plyr-progress-buffer-background: var( --theme-progress-view-off, rgba(255, 255, 255, .25) );--plyr-control-background: var(--theme-bg, rgba(0, 0, 0, .8));--plyr-control-color: var(--theme-text-color, #fff);--plyr-control-button-color: var(--theme-font-bt, #fff)}:host ::ng-deep .plyr__controls{color:var(--plyr-control-color)!important;transition:opacity .2s ease,transform .2s ease}:host ::ng-deep .plyr__controls button{color:var(--plyr-control-color)!important}:host ::ng-deep .plyr__progress__buffer{background-color:var(--plyr-progress-buffer-background)!important}:host ::ng-deep .plyr,:host ::ng-deep .plyr__video-wrapper,:host ::ng-deep .plyr__video-embed,:host ::ng-deep .plyr__video-embed>iframe,:host ::ng-deep video{width:100%!important;height:100%!important;aspect-ratio:auto!important;top:0!important;left:0!important}:host ::ng-deep .mirror{transform:scaleX(-1)!important;-webkit-transform:scaleX(-1)!important}:host ::ng-deep .plyr--video .plyr__control.plyr__tab-focus,:host ::ng-deep .plyr--video .plyr__control:hover,:host ::ng-deep .plyr--video .plyr__control[aria-expanded=true]{background:var(--plyr-color-hover)!important;color:var(--plyr-control-button-color)!important}:host ::ng-deep .plyr--full-ui input[type=range]{color:var(--plyr-color-main)!important}:host ::ng-deep .plyr__menu__container .plyr__control[role=menuitemradio][aria-checked=true]:before{background:var(--plyr-color-main)!important}:host ::ng-deep .plyr__menu__container{background:var(--plyr-control-background)!important;z-index:7!important}:host ::ng-deep .plyr--auto-hide-controls .plyr__controls{opacity:0!important;pointer-events:none!important;transform:translateY(12px)}:host ::ng-deep .ytp-more-videos-view .ytp-suggestions{pointer-events:none!important}:host ::ng-deep .plyr--vimeo .plyr__video-wrapper.plyr__video-embed{aspect-ratio:16 / 9!important;width:100%!important;height:auto!important}\n"] }]
|
|
1517
1543
|
}], ctorParameters: () => [{ type: WebplayerProgressService }, { type: Document, decorators: [{
|
|
1518
1544
|
type: Inject,
|
|
1519
1545
|
args: [DOCUMENT]
|