PluginProbe ʕ •ᴥ•ʔ
Presto Player / 4.4.1
Presto Player v4.4.1
4.4.1 4.4.0 4.3.3 4.3.2 4.3.1 4.3.0 4.2.4 4.2.3 4.2.2 4.2.0 4.2.1 trunk 1.10.0 1.10.1 1.10.2 1.11.0 1.12.0 1.13.0 1.14.0 1.14.1 1.5.10 1.5.11 1.5.12 1.5.13 1.5.14 1.5.15 1.5.5 1.5.6 1.5.7 1.5.8 1.5.9 1.6.0 1.6.1 1.6.10 1.6.11 1.6.12 1.6.13 1.6.2 1.6.3 1.6.4 1.6.5 1.6.6 1.6.7 1.6.8 1.6.9 1.7.0 1.7.1 1.7.2 1.8.0 1.8.1 1.8.2 1.8.3 1.8.4 1.8.5 1.8.6 1.9.0 1.9.1 1.9.10 1.9.11 1.9.12 1.9.13 1.9.14 1.9.2 1.9.3 1.9.4 1.9.5 1.9.6 1.9.7 1.9.8 1.9.9 2.0.0 2.0.1 2.0.10 2.0.11 2.0.12 2.0.13 2.0.14 2.0.15 2.0.16 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7 2.0.8 2.0.9 2.1.0 2.2.0 2.2.1 2.2.2 2.2.3 2.2.3-beta1 2.3.0 2.3.1 2.3.2 2.3.3 3.0.0 3.0.0-beta1 3.0.1 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.0.8 3.1.0 3.1.1 3.1.2 3.1.3 4.0.0 4.0.1 4.0.2 4.0.3 4.0.4 4.0.5 4.0.6 4.0.7 4.0.8 4.1.0 4.1.1 4.1.2 4.1.3 4.1.4
presto-player / src / admin / blocks / shared / Player.js
presto-player / src / admin / blocks / shared Last commit date
MediaProviders 2 months ago ProvidersPlaceholder 2 months ago audioPresets 2 months ago branding 8 months ago chapters 2 years ago components 2 months ago media 2 months ago overlays 2 months ago presets 1 month ago services 4 years ago settings 3 months ago styles 2 years ago tracks 2 months ago BlockInspectorControls.js 2 months ago BlockInspectorControls.scss 2 months ago Editing.js 2 years ago LinkPlaceholder.js 3 months ago Player.js 3 months ago Preview.js 4 days ago ProUpgradeModal.js 3 months ago VisibilityEditor.js 8 months ago audio-placeholder.js 2 months ago helpers.js 5 years ago options.js 2 months ago placeholder.js 2 months ago
Player.js
178 lines
1 import {
2 PrestoPlayer,
3 PrestoSearchBarUi,
4 } from "@presto-player/components-react";
5 import { getProvider } from "../util";
6 import { useRef, useLayoutEffect } from "@wordpress/element";
7 import { useSelect } from "@wordpress/data";
8 import { convertHex } from "../../../shared/util";
9
10 export default (props) => {
11 const {
12 src,
13 classes,
14 preset,
15 branding,
16 attributes,
17 adminPreview,
18 currentTime,
19 preload = "metadata",
20 overlays,
21 type,
22 } = props;
23
24 const ref = useRef();
25 const {
26 previewThumbnail,
27 chapters,
28 poster,
29 mutedOverlay,
30 mutedPreview,
31 title,
32 } = attributes;
33
34 const { youtube, playerCSS } = useSelect((select) => {
35 return {
36 youtube: select("presto-player/player")?.youtube(),
37 playerCSS: select("presto-player/player")?.playerCSS(),
38 };
39 });
40
41 useLayoutEffect(() => {
42 ref.current.src = src;
43 ref.current["data-css"] = playerCSS;
44 ref.current.classes = classes;
45 ref.current.currentTime = currentTime;
46 ref.current.overlays = JSON.stringify(overlays);
47 ref.current.isAdmin = true;
48 ref.current.preload = preload;
49 ref.current.preset = JSON.stringify(preset);
50 ref.current.youtube = {
51 channelId: youtube?.channel_id,
52 };
53 ref.current.tracks = [
54 ...(!!preset?.captions
55 ? [
56 {
57 kind: "captions",
58 label: "English",
59 srclang: "en",
60 src: "/path/to/captions.en.vtt",
61 default: true,
62 },
63 ]
64 : []),
65 ];
66 ref.current.branding = JSON.stringify(branding);
67 ref.current.chapters = JSON.stringify(chapters);
68 ref.current.blockAttributes = attributes;
69 ref.current.poster = poster || previewThumbnail;
70 ref.current.provider = type === "audio" ? "audio" : getProvider(src);
71 ref.current.mediaTitle = title;
72 }, [
73 src,
74 classes,
75 preset,
76 branding,
77 attributes,
78 adminPreview,
79 currentTime,
80 preload,
81 overlays,
82 type,
83 ]);
84
85 const mutedOverlayContent = () => {
86 return (
87 <div
88 className="presto-player__overlay is-image"
89 style={{
90 position: "absolute",
91 width: `${mutedOverlay?.width || 100}%`,
92 left: `${(mutedOverlay?.focalPoint?.x || 0.5) * 100}%`,
93 top: `${(mutedOverlay?.focalPoint?.y || 0.5) * 100}%`,
94 }}
95 >
96 <img
97 src={mutedOverlay?.src}
98 style={{
99 transform: "translateX(-50%) translateY(-50%)",
100 }}
101 />
102 </div>
103 );
104 };
105
106 return (
107 <div
108 className={"wp-block-video presto-block-video"}
109 style={
110 type === "audio"
111 ? {
112 "--presto-player-border-radius": `${preset?.border_radius}px`,
113 ...(preset?.background_color
114 ? {
115 "--plyr-audio-controls-background": preset.background_color,
116 }
117 : { "--plyr-audio-controls-background": branding?.color }),
118 ...(preset?.control_color
119 ? {
120 "--plyr-audio-control-color": preset.control_color,
121 "--plyr-range-thumb-background": preset.control_color,
122 "--plyr-range-fill-background": preset.control_color,
123 "--plyr-audio-progress-buffered-background": convertHex(
124 preset.control_color || branding?.color || "#00b3ff",
125 0.5
126 ),
127 }
128 : {
129 "--plyr-audio-control-color": "#ffffff",
130 "--plyr-range-thumb-background": "#ffffff",
131 "--plyr-range-fill-background": "#ffffff",
132 }),
133 "--plyr-range-thumb-shadow": `0px`,
134 }
135 : {
136 "--presto-player-border-radius": `${preset?.border_radius}px`,
137 "--presto-player-aspect-ratio":
138 attributes?.ratio === "original"
139 ? "unset"
140 : attributes?.ratio?.replace(":", "/") || "16/9",
141 ...(preset?.caption_background
142 ? { "--plyr-captions-background": preset.caption_background }
143 : {}),
144 ...(branding?.color
145 ? {
146 "--plyr-color-main": `var(--presto-player-highlight-color, ${branding.color})`,
147 }
148 : {}),
149 "--presto-player-email-border-radius": `${
150 preset?.email_collection?.border_radius || 0
151 }px`,
152 "--presto-player-logo-width": `${branding?.logo_width || 75}px`,
153 }
154 }
155 >
156 <PrestoPlayer ref={ref}>
157 <div slot="player-end">
158 {!!preset.search?.enabled && (
159 <PrestoSearchBarUi
160 style={{
161 position: "absolute",
162 top: "15px",
163 right: "23px",
164 zIndex: 1,
165 }}
166 placeholder={preset.search?.placeholder}
167 />
168 )}
169 {mutedPreview?.enabled &&
170 mutedOverlay?.enabled &&
171 mutedOverlayContent()}
172 {adminPreview}
173 </div>
174 </PrestoPlayer>
175 </div>
176 );
177 };
178