openplayerjs-youtube

2.3.1 • Public • Published

openplayer

OpenPlayer.js - YouTube

JSDelivr

Now you can play any YouTube videos using the awesome OpenPlayerJS!

🚨 IMPORTANT 🚨

🔧 This repository is in maintenance at this point. 🔧

No new features or addition will be added, only bugfixes.

Installation

  1. Set the video/audio as indicated in the OpenPlayerJS installation.
  2. Set the type of your source as video/x-youtube.
  3. Load this package library right after OpenPlayerJS.
  4. And voilá!

Configuration

It allows you to override YouTube's configuration by using the youtube object in the settings. Check Supported parameters section for more details.

Example

<!DOCTYPE html>
<html lang="en">
  <body>
    <video class="op-player__media" id="video" controls playsinline>
      <source
        src="https://www.youtube.com/watch?v=xcJtL7QggTI"
        type="video/x-youtube"
      />
    </video>
    <script src="https://cdn.jsdelivr.net/npm/openplayerjs@latest/dist/openplayer.min.js"></script>
    <script src="/path/to/openplayerjs-youtube.min.js"></script>
    <script>
      var player = new OpenPlayer("video", {
        youtube: {
          // config
        },
      });
      player.init();
    </script>
  </body>
</html>

A word about Privacy

This YouTube plug-in leverages the Google's YouTube Iframe API, which in turn will allow you to set a regular YouTube URL. However, this URL sets a tracking cookie by default (for marketing purposes).

This alone represents a compliance issue for the European General Data Protection Regulation (GDPR), and potentially for browsers with more strict privacy policies.

This plug-in has an option to disable the cookie in the settings, which in that case is recommended to use in this case: nocookie; however, this is only one of the multiple steps to achieve an experience that is according to what Privacy Policy expects.

To learn more about how to get a better experience with YouTube and GDPR, check this source.

Package Sidebar

Install

npm i openplayerjs-youtube

Weekly Downloads

0

Version

2.3.1

License

MIT

Unpacked Size

65.7 kB

Total Files

12

Last publish

Collaborators

  • rafa8626