# New Addon: VideoLinkField

**URL:** <https://discourse.getcockpit.com/t/new-addon-videolinkfield/836>\
**Category:** Addons\
**Created:** [May 19, 2019, 8:33pm UTC](https://discourse.getcockpit.com/t/new-addon-videolinkfield/836 "2019-05-19T20:33:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![raffaelj](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.getcockpit.com/raffaelj/32/331_2.png) [@raffaelj](https://discourse.getcockpit.com/u/raffaelj)\
**Post date:** [May 19, 2019, 8:33pm UTC](https://discourse.getcockpit.com/t/new-addon-videolinkfield/836/1 "2019-05-19T20:33:56Z")

</div>

> **[raffaelj/cockpit\_VideoLinkField](https://github.com/raffaelj/cockpit_VideoLinkField/)**
>
> Addon for Cockpit CMS - store thumbnails and meta data for video links - raffaelj/cockpit\_VideoLinkField

## Intended Use

You have your own YouTube or Vimeo channel (or you asked for permission before embedding content from other persons) and you want a simple way to build a privacy friendly website with embedded videos.

But embedding external videos directly is a bad idea for multiple reasons:

1. Privacy - Google tracks my visitors if a YouTube iframe loads videos on startup.
2. EUGDPR - I have to ask my visitors before I can embed third party resources with tracking mechanisms
3. Page speed - If my visitors don’t want to see a video, I don’t want to load the preview window with 1-2MB

The idea is simple:

Users have a simple UI to copy and paste a video link without taking care of embed snippets. After loading the data from the Wysiwyg field, the link exists, even if users (or search engine bots) disabled javascript. When the document is ready and the visitor accepted cookie usage and third party requests, a script converts the links to iframes.

## Features

### Custom Field

- has a preview of the thumbnail
- stores an object with these keys:
  - url
  - text
  - title
  - id
  - provider
  - asset\_id

### TinyMCE Plugin

It has no thumbnail preview, but it produces a simple html `<a>` tag with all the data I need to embed it dynamically.

Example output:

`<a href="https://www.youtube.com/watch?v=fSdVs95Kesk" data-video-id="fSdVs95Kesk" data-video-provider="youtube" data-video-thumb="5cdf0b193338621488000156" data-video-width="480" data-video-height="360">Poledance-Show beim Kammgarnspinnereifest 2018</a>`

---

<div class="post-metadata">

**Author:** ![Blistok](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.getcockpit.com/blistok/32/212_2.png) [@Blistok](https://discourse.getcockpit.com/u/Blistok)\
**Post date:** [May 20, 2019, 5:32pm UTC](https://discourse.getcockpit.com/t/new-addon-videolinkfield/836/2 "2019-05-20T17:32:02Z")

</div>

@raffaelj This is great! Thanks!

---

<div class="post-metadata">

**Author:** ![raffaelj](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.getcockpit.com/raffaelj/32/331_2.png) [@raffaelj](https://discourse.getcockpit.com/u/raffaelj)\
**Post date:** [June 5, 2019, 3:57pm UTC](https://discourse.getcockpit.com/t/new-addon-videolinkfield/836/3 "2019-06-05T15:57:34Z")

</div>

I updated the addon right now to work with the [EditorFormats Addon](https://github.com/pauloamgomes/CockpitCms-EditorFormats) from @pauloamgomes.

> <https://github.com/raffaelj/cockpit_VideoLinkField/commit/a19af59de6e40a460b7972fc5ca604bf30b82c58>

If you use both, VideoLinkField and EditorFormats for wysiwyg fields, it won’t be enabled by default anymore. You have to enable it via EditorFormats settings instead.

If you don’t use EditorFormats, the current version 0.1.1 should work like before.
