This package allows you to include Videos from YouTube in a privacy enforced way. After opening the page, the user also has to check a checkbox and with this accept the privacy terms. Only then the connection to YouTube is established and the regular YouTube embed iframe is included.
You can install the package via yarn or npm:
$ yarn add youtube-privacy-embed
$ npm install youtube-privacy-embed --save
Setup
JavaScript:
import * as youtubePrivacyEmbed from 'youtube-privacy-embed';
youtubePrivacyEmbed.initialize('js-privacy-embed');
If wanted, you can also include a basic css file:
@import "node_modules/youtube-privacy-embed/dist/style.css";
Usage
Include the following HTML snippet where you want to show the YouTube video:
<div class="js-privacy-embed"
data-ype-video-id="ZT4WRRhacWk">
</div>
Configuration
You can find the default configuration and all possible options in the config.json file.
You can overwrite them with own parameters on the initialization, like this:
youtubePrivacyEmbed.initialize('js-privacy-embed', {
useNoCookie: false,
videoAutoplay: true
});
You can also overwrite the defaults (and your settings from the configuration) via data-attributes in the html part,
where you at least should include the video id. Please note the changed property names: You must prepend it with data-ype-
,
and convert uppercase letters to -
plus their lowercase equivalent. Eg. the property videoAllowFullscreen
in the JS
settings become data-ype-video-allow-fullscreen
when you set it via the data attributes.
Please see CHANGELOG for more information what has changed recently.
Please see CONTRIBUTING for details.
If you discover any security related issues, please contact basilicom instead of using the issue tracker.
The GPL License (GPL v3.0). Please see License File for more information.
We design and program applications that are far beyond out-of-the-box-solutions. Online, mobile, social. Official Pimcore partner.