Slide: Youtube

The "Youtube" slide let you add easily a Youtube video to your presentation.

Table of contents

Layout

A 16/9 video

0%0/0

Installation

This template could be added to your presentation using the following methods.

If you are using our Starter Kit, no need to worry about this, this template is included, therefore you could skip the "Installation" chapter.

From a CDN

It's recommended to use unpkg if you want to use this template from a CDN. To do so, add the following include script in the main HTML file of your project:

<script type="module" src="https://unpkg.com/@deckdeckgo/slide-youtube@latest/dist/deckdeckgo-slide-youtube/deckdeckgo-slide-youtube.esm.js"></script> <script nomodule="" src="https://unpkg.com/@deckdeckgo/slide-youtube@latest/dist/deckdeckgo-slide-youtube/deckdeckgo-slide-youtube.js"></script>

From NPM

To install this template in your project from npm run the following command:

npm install @deckdeckgo/slide-youtube

Framework integration

The Stencil documentation provide examples of framework integration for Angular, React, Vue and Ember.

That being said, commonly, you might either import or load it:

Import

import '@deckdeckgo/slide-youtube';

Loader

import { defineCustomElements as deckDeckGoSlideElement } from '@deckdeckgo/slide-youtube/dist/loader'; deckDeckGoSlideElement();

Youtube component

This templates relies on the @deckdeckgo/youtube component without any explicit dependency. Therefore it should also be installed, see its related installation guide.

Usage

The "Youtube" slide's Web Component could be integrated using the tag <deckgo-slide-youtube/>.

<deckgo-slide-youtube src="https://www.youtube.com/watch?v=oUOjJIfPIjw"> <h1 slot="title">A 16/9 video</h1> </deckgo-slide-youtube>

Slots

The slot title and content are optional. The slot content is displayed before the video.

Youtube component

The slide "Youtube" relies on the component <deckgo-youtube/> which is described in the components documentation.

Attributes

This component offers the following options which could be set using attributes:

AttributeTypeDefaultDescription
srcstringThe source url, the Youtube url, of the video. Not embeddable url will be automatically converted to embeddable url supported by Youtube.
widthnumberPer default the video width will be calculated according the content size available.Using this option you would be able to define your own width.
heightnumberPer default the video height will be calculated according the content size available.Using this option you would be able to define your own height.
custom-backgroundbooleanfalseIf you would provide a background for the all deck and a specific one for this slide, set this option to true
custom-actionsbooleanfalseIf you would provide actions for the all deck and a specific one for this slide, set this option to true

Theming

The following theming options will affect this component if set on its host or parent.

CSS4 variableDefaultNote
--background
--color
--slide-padding-top16pxPadding top of the all slide
--slide-padding-end32pxPadding right of the all slide
--slide-padding-bottom16pxPadding bottom of the all slide
--slide-padding-start32pxPadding left of the all slide
--zIndex1The z-index of the slide
--slide-youtube-margin0 0 32pxThe margin of the video's container
--slide-youtube-heightcalc(100% - 32px)The height of the video's container
--slide-youtube-overflowautoThe overflow of the video's container

Methods

The slide "Youtube" offers extra methods to play and pause the Youtube video clip. These methods are notably used by the [DeckDecGo]'s remote control.

Play the video

const slide = deck.getElementsByTagName('deckgo-slide-youtube'); await slide.play();

Pause the video

const slide = deck.getElementsByTagName('deckgo-slide-youtube'); await slide.pause();

Toggle the video

Toggle will take care to pause or play the video according its current state.

const slide = deck.getElementsByTagName('deckgo-slide-youtube'); await slide.toggle();