@edm-webplayer/webplayer-angular 0.1.50 → 0.1.51
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.
|
@@ -172,7 +172,7 @@ class PlyrPlayerComponent {
|
|
|
172
172
|
}
|
|
173
173
|
getOverlaySafeZone() {
|
|
174
174
|
const host = this.config?.video_host;
|
|
175
|
-
if (this.overlayBlockAll &&
|
|
175
|
+
if (this.overlayBlockAll && host === "youtube") {
|
|
176
176
|
if (this.playbackEnded) {
|
|
177
177
|
return 0;
|
|
178
178
|
}
|
|
@@ -270,37 +270,6 @@ ${allPairs.map(([n, v]) => ` ${n}: ${v};`).join("\n")}
|
|
|
270
270
|
const code = baseLocale.split("-")[0]?.trim();
|
|
271
271
|
return code ? code.toLowerCase() : null;
|
|
272
272
|
}
|
|
273
|
-
shouldHideVimeoRecommendations() {
|
|
274
|
-
const flag = this.config?.disable_vimeo_recommendations;
|
|
275
|
-
return flag !== false;
|
|
276
|
-
}
|
|
277
|
-
clearVimeoEndedState() {
|
|
278
|
-
if (this.config.video_host !== "vimeo")
|
|
279
|
-
return;
|
|
280
|
-
const container = this.plyr?.elements?.container;
|
|
281
|
-
container?.classList.remove("plyr--vimeo-ended");
|
|
282
|
-
this.toggleRecommendationBlocker(false);
|
|
283
|
-
}
|
|
284
|
-
preventVimeoRecommendations() {
|
|
285
|
-
if (this.config.video_host !== "vimeo")
|
|
286
|
-
return;
|
|
287
|
-
if (!this.shouldHideVimeoRecommendations())
|
|
288
|
-
return;
|
|
289
|
-
try {
|
|
290
|
-
this.plyr?.stop();
|
|
291
|
-
}
|
|
292
|
-
catch { }
|
|
293
|
-
const embed = this.plyr?.embed;
|
|
294
|
-
if (embed && typeof embed.unload === "function") {
|
|
295
|
-
try {
|
|
296
|
-
embed.unload().catch(() => { });
|
|
297
|
-
}
|
|
298
|
-
catch { }
|
|
299
|
-
}
|
|
300
|
-
const container = this.plyr?.elements?.container;
|
|
301
|
-
container?.classList.add("plyr--vimeo-ended");
|
|
302
|
-
this.toggleRecommendationBlocker(true);
|
|
303
|
-
}
|
|
304
273
|
getVideoWrapper() {
|
|
305
274
|
const container = this.plyr?.elements?.container;
|
|
306
275
|
if (!container)
|
|
@@ -348,8 +317,7 @@ ${allPairs.map(([n, v]) => ` ${n}: ${v};`).join("\n")}
|
|
|
348
317
|
return blocker;
|
|
349
318
|
}
|
|
350
319
|
toggleRecommendationBlocker(active) {
|
|
351
|
-
if (this.config.video_host !== "youtube"
|
|
352
|
-
this.config.video_host !== "vimeo") {
|
|
320
|
+
if (this.config.video_host !== "youtube") {
|
|
353
321
|
return;
|
|
354
322
|
}
|
|
355
323
|
const blocker = this.ensureRecommendationBlocker();
|
|
@@ -438,8 +406,7 @@ ${allPairs.map(([n, v]) => ` ${n}: ${v};`).join("\n")}
|
|
|
438
406
|
catch { }
|
|
439
407
|
}
|
|
440
408
|
ensureTopClickBlocker() {
|
|
441
|
-
if (this.config.video_host !== "youtube"
|
|
442
|
-
this.config.video_host !== "vimeo") {
|
|
409
|
+
if (this.config.video_host !== "youtube") {
|
|
443
410
|
return;
|
|
444
411
|
}
|
|
445
412
|
const wrapper = this.getVideoWrapper();
|
|
@@ -509,19 +476,14 @@ ${allPairs.map(([n, v]) => ` ${n}: ${v};`).join("\n")}
|
|
|
509
476
|
return "ontouchstart" in window;
|
|
510
477
|
}
|
|
511
478
|
isIframeProvider() {
|
|
512
|
-
return
|
|
513
|
-
this.config?.video_host === "vimeo");
|
|
479
|
+
return this.config?.video_host === "youtube";
|
|
514
480
|
}
|
|
515
481
|
shouldDisableAutoplayForIOS() {
|
|
516
482
|
return this.isIOSDevice();
|
|
517
483
|
}
|
|
518
|
-
tryEnterVimeoFullscreen() { }
|
|
519
|
-
shouldDisableAutoplayForVimeo() {
|
|
520
|
-
return this.isIOSDevice() && this.config?.video_host === "vimeo";
|
|
521
|
-
}
|
|
522
484
|
shouldResetProgressToBeginning() {
|
|
523
485
|
const host = this.config?.video_host;
|
|
524
|
-
if (host !== "youtube"
|
|
486
|
+
if (host !== "youtube") {
|
|
525
487
|
return false;
|
|
526
488
|
}
|
|
527
489
|
const seenFlag = this.config?.seen;
|
|
@@ -545,8 +507,7 @@ ${allPairs.map(([n, v]) => ` ${n}: ${v};`).join("\n")}
|
|
|
545
507
|
return !!(this.config?.autoplay || this.config?.is_live);
|
|
546
508
|
}
|
|
547
509
|
shouldAutoplay() {
|
|
548
|
-
if (this.shouldDisableAutoplayForIOS()
|
|
549
|
-
this.shouldDisableAutoplayForVimeo()) {
|
|
510
|
+
if (this.shouldDisableAutoplayForIOS()) {
|
|
550
511
|
return false;
|
|
551
512
|
}
|
|
552
513
|
return this.wantsAutoplay();
|
|
@@ -558,7 +519,7 @@ ${allPairs.map(([n, v]) => ` ${n}: ${v};`).join("\n")}
|
|
|
558
519
|
return this.wantsAutoplay();
|
|
559
520
|
}
|
|
560
521
|
shouldBlockIframeAutoplay() {
|
|
561
|
-
return
|
|
522
|
+
return this.shouldDisableAutoplayForIOS();
|
|
562
523
|
}
|
|
563
524
|
stopRestrictedIframeAutoplay() {
|
|
564
525
|
if (!this.shouldBlockIframeAutoplay()) {
|
|
@@ -609,34 +570,6 @@ ${allPairs.map(([n, v]) => ` ${n}: ${v};`).join("\n")}
|
|
|
609
570
|
catch { }
|
|
610
571
|
}
|
|
611
572
|
}
|
|
612
|
-
enforceVimeoVolumeAfterPlay(video) {
|
|
613
|
-
if (this.config?.video_host !== "vimeo") {
|
|
614
|
-
return;
|
|
615
|
-
}
|
|
616
|
-
const media = video ?? this.videoRef?.nativeElement ?? null;
|
|
617
|
-
const volumeTarget = 1;
|
|
618
|
-
const attemptRestore = () => {
|
|
619
|
-
this.setPlayerMutedState(false, volumeTarget, media);
|
|
620
|
-
const currentEmbed = this.plyr?.embed;
|
|
621
|
-
if (currentEmbed) {
|
|
622
|
-
if (typeof currentEmbed.setMuted === "function") {
|
|
623
|
-
try {
|
|
624
|
-
currentEmbed.setMuted(false);
|
|
625
|
-
}
|
|
626
|
-
catch { }
|
|
627
|
-
}
|
|
628
|
-
if (typeof currentEmbed.setVolume === "function") {
|
|
629
|
-
try {
|
|
630
|
-
currentEmbed.setVolume(volumeTarget);
|
|
631
|
-
}
|
|
632
|
-
catch { }
|
|
633
|
-
}
|
|
634
|
-
}
|
|
635
|
-
};
|
|
636
|
-
[0, 250, 500, 750].forEach((offset) => {
|
|
637
|
-
setTimeout(attemptRestore, 500 + offset);
|
|
638
|
-
});
|
|
639
|
-
}
|
|
640
573
|
setPlayerMutedState(muted, volume = 1, target) {
|
|
641
574
|
if (this.plyr) {
|
|
642
575
|
try {
|
|
@@ -826,17 +759,6 @@ ${allPairs.map(([n, v]) => ` ${n}: ${v};`).join("\n")}
|
|
|
826
759
|
if (!Number.isFinite(target) || target < 0) {
|
|
827
760
|
return null;
|
|
828
761
|
}
|
|
829
|
-
if (this.config.video_host === "vimeo") {
|
|
830
|
-
const embed = this.plyr?.embed;
|
|
831
|
-
if (embed && typeof embed.setCurrentTime === "function") {
|
|
832
|
-
try {
|
|
833
|
-
return embed.setCurrentTime(target);
|
|
834
|
-
}
|
|
835
|
-
catch {
|
|
836
|
-
return null;
|
|
837
|
-
}
|
|
838
|
-
}
|
|
839
|
-
}
|
|
840
762
|
if (video) {
|
|
841
763
|
try {
|
|
842
764
|
video.currentTime = target;
|
|
@@ -929,14 +851,6 @@ ${allPairs.map(([n, v]) => ` ${n}: ${v};`).join("\n")}
|
|
|
929
851
|
catch { }
|
|
930
852
|
}
|
|
931
853
|
}
|
|
932
|
-
else if (this.config.video_host === "vimeo") {
|
|
933
|
-
if (typeof embed.play === "function") {
|
|
934
|
-
try {
|
|
935
|
-
embed.play();
|
|
936
|
-
}
|
|
937
|
-
catch { }
|
|
938
|
-
}
|
|
939
|
-
}
|
|
940
854
|
}
|
|
941
855
|
setupControlsVisibility() {
|
|
942
856
|
const container = this.plyr?.elements?.container;
|
|
@@ -1075,8 +989,6 @@ ${allPairs.map(([n, v]) => ` ${n}: ${v};`).join("\n")}
|
|
|
1075
989
|
const speedOptions = [1, 1.25, 1.5, 2];
|
|
1076
990
|
const locale = this.resolveLocale();
|
|
1077
991
|
const captionsLanguage = this.resolveCaptionsLanguage(locale) ?? "pt";
|
|
1078
|
-
const hideVimeoRecommendations = this.shouldHideVimeoRecommendations();
|
|
1079
|
-
const vimeoPremium = Boolean(this.config?.vimeo_premium);
|
|
1080
992
|
const shouldAutoplay = this.shouldAutoplay();
|
|
1081
993
|
const startMuted = this.requiresMutedAutoplay();
|
|
1082
994
|
try {
|
|
@@ -1207,13 +1119,10 @@ ${allPairs.map(([n, v]) => ` ${n}: ${v};`).join("\n")}
|
|
|
1207
1119
|
};
|
|
1208
1120
|
this.plyr?.on?.("play", () => {
|
|
1209
1121
|
this.retryPendingStartTime();
|
|
1210
|
-
this.clearVimeoEndedState();
|
|
1211
1122
|
this.playbackEnded = false;
|
|
1212
1123
|
this.overlayBlockAll = false;
|
|
1213
1124
|
this.updateRecommendationBlockerSafeZone();
|
|
1214
1125
|
this.toggleRecommendationBlocker(false);
|
|
1215
|
-
this.tryEnterVimeoFullscreen();
|
|
1216
|
-
this.enforceVimeoVolumeAfterPlay();
|
|
1217
1126
|
parent.postMessage("playing_video", "*");
|
|
1218
1127
|
this.postCastEvent({
|
|
1219
1128
|
event: "play",
|
|
@@ -1245,7 +1154,6 @@ ${allPairs.map(([n, v]) => ` ${n}: ${v};`).join("\n")}
|
|
|
1245
1154
|
currentTime: this.plyr.currentTime || 0,
|
|
1246
1155
|
});
|
|
1247
1156
|
this.progressService.ended$.next();
|
|
1248
|
-
this.preventVimeoRecommendations();
|
|
1249
1157
|
this.toggleRecommendationBlocker(true);
|
|
1250
1158
|
});
|
|
1251
1159
|
}
|
|
@@ -1301,8 +1209,7 @@ ${allPairs.map(([n, v]) => ` ${n}: ${v};`).join("\n")}
|
|
|
1301
1209
|
this.hls = undefined;
|
|
1302
1210
|
}
|
|
1303
1211
|
this.resetPlaybackRate(video);
|
|
1304
|
-
if (this.config.video_host === "youtube"
|
|
1305
|
-
this.config.video_host === "vimeo") {
|
|
1212
|
+
if (this.config.video_host === "youtube") {
|
|
1306
1213
|
const onReady = () => {
|
|
1307
1214
|
this.plyr.off("ready", onReady);
|
|
1308
1215
|
this.ensureIframeAutoplayPermissions();
|
|
@@ -1346,12 +1253,6 @@ ${allPairs.map(([n, v]) => ` ${n}: ${v};`).join("\n")}
|
|
|
1346
1253
|
sources: [{ src: this.config.video_id, provider: "youtube" }],
|
|
1347
1254
|
};
|
|
1348
1255
|
}
|
|
1349
|
-
else if (this.config.video_host === "vimeo") {
|
|
1350
|
-
this.plyr.source = {
|
|
1351
|
-
type: "video",
|
|
1352
|
-
sources: [{ src: this.config.video_id, provider: "vimeo" }],
|
|
1353
|
-
};
|
|
1354
|
-
}
|
|
1355
1256
|
else if (this.config.video_host === "mp4") {
|
|
1356
1257
|
this.plyr.source = {
|
|
1357
1258
|
type: "video",
|
|
@@ -1505,7 +1406,6 @@ ${allPairs.map(([n, v]) => ` ${n}: ${v};`).join("\n")}
|
|
|
1505
1406
|
this.controlsVisibilityCleanup = undefined;
|
|
1506
1407
|
this.clearAutoplayUnlockListener();
|
|
1507
1408
|
const container = this.plyr?.elements?.container;
|
|
1508
|
-
container?.classList.remove("plyr--vimeo-ended");
|
|
1509
1409
|
if (this.recommendationBlocker?.parentElement) {
|
|
1510
1410
|
try {
|
|
1511
1411
|
this.recommendationBlocker.parentElement.removeChild(this.recommendationBlocker);
|
|
@@ -1537,11 +1437,11 @@ ${allPairs.map(([n, v]) => ` ${n}: ${v};`).join("\n")}
|
|
|
1537
1437
|
window.removeEventListener("message", this.onCastMessage);
|
|
1538
1438
|
}
|
|
1539
1439
|
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 });
|
|
1540
|
-
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}
|
|
1440
|
+
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}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }] });
|
|
1541
1441
|
}
|
|
1542
1442
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: PlyrPlayerComponent, decorators: [{
|
|
1543
1443
|
type: Component,
|
|
1544
|
-
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}
|
|
1444
|
+
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}\n"] }]
|
|
1545
1445
|
}], ctorParameters: () => [{ type: WebplayerProgressService }, { type: Document, decorators: [{
|
|
1546
1446
|
type: Inject,
|
|
1547
1447
|
args: [DOCUMENT]
|
|
@@ -1554,6 +1454,243 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
|
|
|
1554
1454
|
type: Output
|
|
1555
1455
|
}] } });
|
|
1556
1456
|
|
|
1457
|
+
class VimeoPlayerComponent {
|
|
1458
|
+
progressService;
|
|
1459
|
+
document;
|
|
1460
|
+
config;
|
|
1461
|
+
ready = new EventEmitter();
|
|
1462
|
+
videoRef;
|
|
1463
|
+
plyr;
|
|
1464
|
+
onCastMessage = (event) => {
|
|
1465
|
+
let data = event.data;
|
|
1466
|
+
if (typeof data === 'string') {
|
|
1467
|
+
try {
|
|
1468
|
+
data = JSON.parse(data);
|
|
1469
|
+
}
|
|
1470
|
+
catch { }
|
|
1471
|
+
}
|
|
1472
|
+
if (data?.action === 'request-iframe-media-metadata') {
|
|
1473
|
+
this.postCastEvent({
|
|
1474
|
+
event: 'metadata',
|
|
1475
|
+
duration: this.plyr?.duration || 0,
|
|
1476
|
+
currentTime: this.plyr?.currentTime || 0,
|
|
1477
|
+
});
|
|
1478
|
+
}
|
|
1479
|
+
if (data?.action === 'play') {
|
|
1480
|
+
this.plyr?.play?.();
|
|
1481
|
+
}
|
|
1482
|
+
if (data?.action === 'pause') {
|
|
1483
|
+
this.plyr?.pause?.();
|
|
1484
|
+
}
|
|
1485
|
+
if (data?.action === 'seek' && typeof data.time === 'number') {
|
|
1486
|
+
this.plyr && (this.plyr.currentTime = data.time);
|
|
1487
|
+
}
|
|
1488
|
+
};
|
|
1489
|
+
constructor(progressService, document) {
|
|
1490
|
+
this.progressService = progressService;
|
|
1491
|
+
this.document = document;
|
|
1492
|
+
}
|
|
1493
|
+
ngOnInit() {
|
|
1494
|
+
this.applyTheme(this.config?.ui?.colors);
|
|
1495
|
+
}
|
|
1496
|
+
ngAfterViewInit() {
|
|
1497
|
+
this.setupPlayer();
|
|
1498
|
+
}
|
|
1499
|
+
ngOnChanges(changes) {
|
|
1500
|
+
if (changes['config'] && this.plyr) {
|
|
1501
|
+
this.setupPlayer();
|
|
1502
|
+
}
|
|
1503
|
+
}
|
|
1504
|
+
setupPlayer() {
|
|
1505
|
+
if (!this.videoRef) {
|
|
1506
|
+
return;
|
|
1507
|
+
}
|
|
1508
|
+
this.plyr?.destroy();
|
|
1509
|
+
const shouldAutoplay = !!(this.config?.autoplay && !this.isIOSDevice());
|
|
1510
|
+
const startMuted = shouldAutoplay;
|
|
1511
|
+
const speedOptions = [1, 1.25, 1.5, 2];
|
|
1512
|
+
const options = {
|
|
1513
|
+
controls: [
|
|
1514
|
+
'play-large',
|
|
1515
|
+
'play',
|
|
1516
|
+
'progress',
|
|
1517
|
+
'current-time',
|
|
1518
|
+
'duration',
|
|
1519
|
+
'mute',
|
|
1520
|
+
'volume',
|
|
1521
|
+
'captions',
|
|
1522
|
+
'settings',
|
|
1523
|
+
'pip',
|
|
1524
|
+
'airplay',
|
|
1525
|
+
'fullscreen',
|
|
1526
|
+
],
|
|
1527
|
+
clickToPlay: true,
|
|
1528
|
+
autoplay: shouldAutoplay,
|
|
1529
|
+
muted: startMuted,
|
|
1530
|
+
keyboard: { focused: true, global: false },
|
|
1531
|
+
hideControls: false,
|
|
1532
|
+
i18n: {
|
|
1533
|
+
speed: "Velocidade",
|
|
1534
|
+
},
|
|
1535
|
+
speed: {
|
|
1536
|
+
selected: 1,
|
|
1537
|
+
options: speedOptions,
|
|
1538
|
+
},
|
|
1539
|
+
fullscreen: {
|
|
1540
|
+
enabled: true,
|
|
1541
|
+
fallback: true,
|
|
1542
|
+
iosNative: true,
|
|
1543
|
+
container: null,
|
|
1544
|
+
},
|
|
1545
|
+
};
|
|
1546
|
+
options.vimeo = {
|
|
1547
|
+
autopause: true,
|
|
1548
|
+
autoplay: shouldAutoplay,
|
|
1549
|
+
muted: startMuted,
|
|
1550
|
+
playsinline: !this.isIOSDevice(),
|
|
1551
|
+
byline: false,
|
|
1552
|
+
portrait: false,
|
|
1553
|
+
title: false,
|
|
1554
|
+
pip: false,
|
|
1555
|
+
controls: false,
|
|
1556
|
+
};
|
|
1557
|
+
this.plyr = new Plyr.default(this.videoRef.nativeElement, options);
|
|
1558
|
+
this.plyr.source = {
|
|
1559
|
+
type: 'video',
|
|
1560
|
+
sources: [{ src: this.config.video_id, provider: 'vimeo' }],
|
|
1561
|
+
};
|
|
1562
|
+
this.bindEvents();
|
|
1563
|
+
}
|
|
1564
|
+
bindEvents() {
|
|
1565
|
+
if (!this.plyr)
|
|
1566
|
+
return;
|
|
1567
|
+
const onTimeUpdate = () => {
|
|
1568
|
+
const current = this.plyr.currentTime || 0;
|
|
1569
|
+
const duration = this.plyr.duration || 0;
|
|
1570
|
+
const percent = duration > 0 ? +((current / duration) * 100).toFixed(2) : 0;
|
|
1571
|
+
this.progressService.progress$.next({ currentTime: current, duration, percent });
|
|
1572
|
+
};
|
|
1573
|
+
this.plyr.on('ready', () => {
|
|
1574
|
+
const duration = this.plyr.duration || 0;
|
|
1575
|
+
const start = this.resolveStartTime(this.config.last_time, this.config.last_percent, duration);
|
|
1576
|
+
if (start > 0) {
|
|
1577
|
+
this.plyr.currentTime = start;
|
|
1578
|
+
}
|
|
1579
|
+
console.log('event: ready');
|
|
1580
|
+
parent.postMessage('duration:' + duration, '*');
|
|
1581
|
+
parent.postMessage('playerIsReadyToPlay', '*');
|
|
1582
|
+
this.ready.emit();
|
|
1583
|
+
});
|
|
1584
|
+
this.plyr.on('timeupdate', onTimeUpdate);
|
|
1585
|
+
this.plyr.on('play', () => {
|
|
1586
|
+
this.progressService.ended$.next();
|
|
1587
|
+
console.log('event: playing_video');
|
|
1588
|
+
parent.postMessage('playing_video', '*');
|
|
1589
|
+
this.postCastEvent({
|
|
1590
|
+
event: 'play',
|
|
1591
|
+
currentTime: this.plyr.currentTime || 0,
|
|
1592
|
+
});
|
|
1593
|
+
onTimeUpdate();
|
|
1594
|
+
});
|
|
1595
|
+
this.plyr.on('pause', () => {
|
|
1596
|
+
console.log('event: pause');
|
|
1597
|
+
parent.postMessage('paused_video', '*');
|
|
1598
|
+
this.postCastEvent({
|
|
1599
|
+
event: 'pause',
|
|
1600
|
+
currentTime: this.plyr.currentTime || 0,
|
|
1601
|
+
});
|
|
1602
|
+
onTimeUpdate();
|
|
1603
|
+
});
|
|
1604
|
+
this.plyr.on('ended', () => {
|
|
1605
|
+
console.log('event: ended');
|
|
1606
|
+
parent.postMessage('event: ended', '*');
|
|
1607
|
+
this.postCastEvent({
|
|
1608
|
+
event: 'ended',
|
|
1609
|
+
currentTime: this.plyr.currentTime || 0,
|
|
1610
|
+
});
|
|
1611
|
+
onTimeUpdate();
|
|
1612
|
+
this.progressService.ended$.next();
|
|
1613
|
+
});
|
|
1614
|
+
}
|
|
1615
|
+
resolveStartTime(last_time, last_percent, duration) {
|
|
1616
|
+
const dur = Number(duration) || 0;
|
|
1617
|
+
if (dur <= 0)
|
|
1618
|
+
return 0;
|
|
1619
|
+
if (last_time && Number(last_time) > 0) {
|
|
1620
|
+
return Math.min(Number(last_time), dur - 2);
|
|
1621
|
+
}
|
|
1622
|
+
if (last_percent && Number(last_percent) > 0) {
|
|
1623
|
+
let percent = Number(last_percent);
|
|
1624
|
+
if (percent > 1) {
|
|
1625
|
+
percent = percent / 100;
|
|
1626
|
+
}
|
|
1627
|
+
return Math.min(percent * dur, dur - 2);
|
|
1628
|
+
}
|
|
1629
|
+
return 0;
|
|
1630
|
+
}
|
|
1631
|
+
isIOSDevice() {
|
|
1632
|
+
if (typeof navigator === 'undefined')
|
|
1633
|
+
return false;
|
|
1634
|
+
const ua = navigator.userAgent || '';
|
|
1635
|
+
const iOS = /iPad|iPhone|iPod/.test(ua);
|
|
1636
|
+
const iPadOS = navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1;
|
|
1637
|
+
return iOS || iPadOS;
|
|
1638
|
+
}
|
|
1639
|
+
ngOnDestroy() {
|
|
1640
|
+
this.plyr?.destroy();
|
|
1641
|
+
if (typeof window !== 'undefined') {
|
|
1642
|
+
window.removeEventListener('message', this.onCastMessage);
|
|
1643
|
+
}
|
|
1644
|
+
}
|
|
1645
|
+
postCastEvent(payload) {
|
|
1646
|
+
parent.postMessage(JSON.stringify(payload), '*');
|
|
1647
|
+
}
|
|
1648
|
+
applyTheme(colors) {
|
|
1649
|
+
if (!colors)
|
|
1650
|
+
return;
|
|
1651
|
+
const STYLE_ID = 'webplayer-theme-vars';
|
|
1652
|
+
let styleEl = this.document.getElementById(STYLE_ID);
|
|
1653
|
+
if (!styleEl) {
|
|
1654
|
+
styleEl = this.document.createElement('style');
|
|
1655
|
+
styleEl.id = STYLE_ID;
|
|
1656
|
+
this.document.head.appendChild(styleEl);
|
|
1657
|
+
}
|
|
1658
|
+
const rootStyle = this.document.documentElement.style;
|
|
1659
|
+
const allPairs = [];
|
|
1660
|
+
for (const key in colors) {
|
|
1661
|
+
if (Object.prototype.hasOwnProperty.call(colors, key)) {
|
|
1662
|
+
const cssVarName = `--theme-${key.replace('progresss-', 'progress-')}`;
|
|
1663
|
+
const cssVarValue = String(colors[key]);
|
|
1664
|
+
allPairs.push([cssVarName, cssVarValue]);
|
|
1665
|
+
try {
|
|
1666
|
+
rootStyle.setProperty(cssVarName, cssVarValue);
|
|
1667
|
+
}
|
|
1668
|
+
catch { }
|
|
1669
|
+
}
|
|
1670
|
+
}
|
|
1671
|
+
const cssRule = `:root{
|
|
1672
|
+
${allPairs.map(([n, v]) => ` ${n}: ${v};`).join('\n')}
|
|
1673
|
+
}`;
|
|
1674
|
+
styleEl.textContent = cssRule;
|
|
1675
|
+
}
|
|
1676
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: VimeoPlayerComponent, deps: [{ token: WebplayerProgressService }, { token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Component });
|
|
1677
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.14", type: VimeoPlayerComponent, isStandalone: true, selector: "app-vimeo-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{width:100%!important;height:100%!important;top:0!important;left:0!important;background:#000!important}:host ::ng-deep .plyr__video-embed>iframe,:host ::ng-deep video{max-height:100%!important;object-fit:contain!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 }] });
|
|
1678
|
+
}
|
|
1679
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: VimeoPlayerComponent, decorators: [{
|
|
1680
|
+
type: Component,
|
|
1681
|
+
args: [{ selector: 'app-vimeo-player', standalone: true, imports: [CommonModule], template: `<video #video playsinline></video>`, 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{width:100%!important;height:100%!important;top:0!important;left:0!important;background:#000!important}:host ::ng-deep .plyr__video-embed>iframe,:host ::ng-deep video{max-height:100%!important;object-fit:contain!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"] }]
|
|
1682
|
+
}], ctorParameters: () => [{ type: WebplayerProgressService }, { type: Document, decorators: [{
|
|
1683
|
+
type: Inject,
|
|
1684
|
+
args: [DOCUMENT]
|
|
1685
|
+
}] }], propDecorators: { config: [{
|
|
1686
|
+
type: Input
|
|
1687
|
+
}], ready: [{
|
|
1688
|
+
type: Output
|
|
1689
|
+
}], videoRef: [{
|
|
1690
|
+
type: ViewChild,
|
|
1691
|
+
args: ['video', { static: true }]
|
|
1692
|
+
}] } });
|
|
1693
|
+
|
|
1557
1694
|
class PandaPlayerComponent {
|
|
1558
1695
|
elementRef;
|
|
1559
1696
|
progressService;
|
|
@@ -2043,11 +2180,11 @@ class PlayerLoaderComponent {
|
|
|
2043
2180
|
[config]="config"
|
|
2044
2181
|
(ready)="onPlayerReady()"
|
|
2045
2182
|
></app-plyr-player>
|
|
2046
|
-
<app-
|
|
2183
|
+
<app-vimeo-player
|
|
2047
2184
|
*ngSwitchCase="'vimeo'"
|
|
2048
2185
|
[config]="config"
|
|
2049
2186
|
(ready)="onPlayerReady()"
|
|
2050
|
-
></app-
|
|
2187
|
+
></app-vimeo-player>
|
|
2051
2188
|
<app-panda-player
|
|
2052
2189
|
*ngSwitchCase="'panda'"
|
|
2053
2190
|
[config]="config"
|
|
@@ -2063,7 +2200,7 @@ class PlayerLoaderComponent {
|
|
|
2063
2200
|
</div>
|
|
2064
2201
|
</div>
|
|
2065
2202
|
</div>
|
|
2066
|
-
`, isInline: true, styles: [":host{display:block;width:100%;height:100%}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i2.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { kind: "directive", type: i2.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { kind: "directive", type: i2.NgSwitchDefault, selector: "[ngSwitchDefault]" }, { kind: "component", type: PlyrPlayerComponent, selector: "app-plyr-player", inputs: ["config"], outputs: ["ready"] }, { kind: "component", type: PandaPlayerComponent, selector: "app-panda-player", inputs: ["config"], outputs: ["ready"] }, { kind: "component", type: ScaleupPlayerComponent, selector: "app-scaleup-player", inputs: ["config"], outputs: ["ready"] }] });
|
|
2203
|
+
`, isInline: true, styles: [":host{display:block;width:100%;height:100%}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i2.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { kind: "directive", type: i2.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { kind: "directive", type: i2.NgSwitchDefault, selector: "[ngSwitchDefault]" }, { kind: "component", type: PlyrPlayerComponent, selector: "app-plyr-player", inputs: ["config"], outputs: ["ready"] }, { kind: "component", type: VimeoPlayerComponent, selector: "app-vimeo-player", inputs: ["config"], outputs: ["ready"] }, { kind: "component", type: PandaPlayerComponent, selector: "app-panda-player", inputs: ["config"], outputs: ["ready"] }, { kind: "component", type: ScaleupPlayerComponent, selector: "app-scaleup-player", inputs: ["config"], outputs: ["ready"] }] });
|
|
2067
2204
|
}
|
|
2068
2205
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: PlayerLoaderComponent, decorators: [{
|
|
2069
2206
|
type: Component,
|
|
@@ -2085,11 +2222,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
|
|
|
2085
2222
|
[config]="config"
|
|
2086
2223
|
(ready)="onPlayerReady()"
|
|
2087
2224
|
></app-plyr-player>
|
|
2088
|
-
<app-
|
|
2225
|
+
<app-vimeo-player
|
|
2089
2226
|
*ngSwitchCase="'vimeo'"
|
|
2090
2227
|
[config]="config"
|
|
2091
2228
|
(ready)="onPlayerReady()"
|
|
2092
|
-
></app-
|
|
2229
|
+
></app-vimeo-player>
|
|
2093
2230
|
<app-panda-player
|
|
2094
2231
|
*ngSwitchCase="'panda'"
|
|
2095
2232
|
[config]="config"
|
|
@@ -2108,6 +2245,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
|
|
|
2108
2245
|
`, standalone: true, imports: [
|
|
2109
2246
|
CommonModule,
|
|
2110
2247
|
PlyrPlayerComponent,
|
|
2248
|
+
VimeoPlayerComponent,
|
|
2111
2249
|
PandaPlayerComponent,
|
|
2112
2250
|
ScaleupPlayerComponent,
|
|
2113
2251
|
], styles: [":host{display:block;width:100%;height:100%}\n"] }]
|