Phplugins Media

Hi all,

so with the new audio/video support the following entry in phplugins is obsolete???

// Enable Media
function head() {
echo <<<HTML



<!-- Colorscheme light for browsers -->
<meta name="color-scheme" content="light only">

HTML;
return false;
} // END /**/

	function essay_script() {
		echo <<<HTML
<script>
	renderAs['media'] = {
		fields: [
			{
				label: "Media URL",
				name: "src",
				type: "text",
			},
			{
				label: "Media title",
				name: "title",
				type: "text",
			},
		],
		skipTemplate: (placeholder, group, photoIds) => {
			if (!placeholder.dataset.src) return;

			let photo = "";
			if (photoIds.length) {
				photo = albumImages[photoIds[0]];
			}

			placeholder.innerHTML = (`
				<div class="presentation-interior">
					<media-player src="\${placeholder.dataset.src || ""}" title="\${placeholder.dataset.title || ""}" playsinline>
						<media-provider>
							\${photo ? (`
								<media-poster alt="\${photo.filename}" class="vds-poster" src="\${photo.path}photos/\${photo.filename}"></media-poster>
							`) : (`
								<media-poster class="vds-poster"></media-poster>
							`)}
						</media-provider>
						<media-audio-layout></media-audio-layout>
						<media-video-layout></media-video-layout>
					</media-player>
				</div>
			`);
		},
		title: "Media",
		useWithoutImages: true,
	};

	placeholders.push(...Array.from(document.querySelectorAll('div[data-presentation="media"]')));
</script>

HTML;
// do not indent line above
return false;
} // END /**/

Best regards,
Oliver

Yes. According to the newsletter email Matt sent out it should be removed.

1 Like

Yes, you can remove it.

Unless you want to continue using the CDN files instead of hosting locally, in which case, you can keep the PHPlugin, but disable the feature in your template.

In any case, don’t be doing both things at once.