Skip to content

basilicom/youtube-privacy-embed

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Basilicom's Youtube Privacy Embed

Latest Version on NPM Software License

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.

Install

You can install the package via yarn or npm:

$ yarn add youtube-privacy-embed
$ npm install youtube-privacy-embed --save

Usage

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.

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please contact basilicom instead of using the issue tracker.

License

The GPL License (GPL v3.0). Please see License File for more information.

Credits

About Basilicom

We design and program applications that are far beyond out-of-the-box-solutions. Online, mobile, social. Official Pimcore partner.