"Download":https://github.com/NicolasGraph/oui_youtube/releases the compiled plugin file or the source to compile a customized file.

August 15, 2018 · View on GitHub

h1. oui_youtube

  • "Introduction":#introduction
  • "Plugin management":#plugin-management
  • "Tags and parameters":#tags-and-parameters
  • "Examples":#examples
  • "Credits":#credits

h2. Introduction

"oui_youtube":https://github.com/NicolasGraph/oui_youtube is a "oui_player":https://github.com/NicolasGraph/oui_player v2+ extension to easily embed "YouTube":https://youtube.com/ provided videos in "Textpattern":https://textpattern.com/ powered websites.

The above platform serves cookies with its player, according to the EU legislation, you should warn your users about these cookies before they are added. This can be done by using "oui_cookie":https://github.com/NicolasGraph/oui_cookie.

h3. Plugin requirements

oui_youtube's minimum requirements:

h2. Plugin management

h3. Installation

h4. From the admin interface

"Download":https://github.com/NicolasGraph/oui_youtube/releases the compiled plugin file or the source to compile a customized file.

Paste the content of the compiled plugin file under the "Admin > Plugins":?event=plugin tab and click the Upload button.

Confirm the plugin install by clicking the Install button on the plugin preview page.

Enable the plugin and click the Options link (or visit the Preferences tab) to set the provider preferences.

h4. Via Composer (not available yet)

After "installing Composer":https://getcomposer.org/doc/00-intro.md…

Target your project directory:

@$ cd /path/to/your/textpattern/installation/dir@

If it's not already done, lock your version of Txp:

@$ composer require textpattern/lock:4.6.2@, where @4.6.2@ is the Txp version in use.

Install oui_youtube:

@$ composer require nicolasgraph/oui_youtube@

h3. Update

h4. From the admin interface

Follow the installation instruction above.

h4. Via Composer (not available yet)

bc. $ composer update nicolasgraph/oui_youtube

h3. Uninstall

h4. From the admin interface

Check the box on the left of the plugin row under the "Admin > Plugins":?event=plugin.

open the select list at the bottom of the plugins table and choose Delete.

confirm the plugin deletion.

h4. Via Composer (not available yet)

bc. $ composer remove nicolasgraph/oui_youtube

h2. Tags and parameters

h3. oui_youtube vs oui_player

While the @<txp:oui_player />@ tag is able to embed any video from any extension-related provider, the @<txp:oui_youtube />@ tag is a shortcut to embed YouTube videos only. It is strictly equivalent to @<txp:oui_player provider="youtube" />@.

Check the "oui_player":https://github.com/NicolasGraph/oui_player documentation for more informations.

h4. Valid values for the play attribute

When using the @oui_player@ tag (vs @oui_youtube@), the right provider needs to be set if the @play@ value or its field related one is an ID. It is optional, but can fasten the rendering, if the value is an URL.

h4. Player customization

h5. Preferences vs attributes

While some player customization elements, related to the media to play, should be used through attributes, these used as global settings should preferrably be set through the plugin preferences to avoid a massive use of tag attributes.

Of course, it is still possible to override a preference value via an attribute when needed.

h5. Size

  • @width@ := Integer; initially set to @560@. The width of the player in pixels. =:
  • @height@ := Integer; initially set to @315@. The height of the player in pixels. =:
  • @ratio@ := Integer[@:@]integer; initially not set. The ratio used to calculate the missing value for the width or the height. =:
  • @responsive@ := @true@ or @false@; initially set to @false@. Adapts the final player size from the provided width and/or height and/or ratio values to fit the container width. Wraps the player and adds some styles. =:

h5. Parameters (a→z)

From Txp 4.7, paramaters accepting @0@ and @1@ as valid values can be enable through boolean/valueless attributes.

  • @autohide@ := @0@, @1@ or @2@; initially set to @2@. Indicates whether the video controls will automatically hide after a video begins playing. This parameter has been deprecated for HTML5 players, which display or hide the video progress bar and player controls automatically (autohide=1). =:
  • @autoplay@ := @0@ or @1@; initially set to @0@. Specifies whether the initial video will automatically start to play when the player loads. =:
  • @cc_load_policy@ := @0@ or @1@; initially set to @0@. 1 causes closed captions to be shown by default, even if the user has turned captions off. =:
  • @color@ := @red@ or @white@; initially set to @red@. Specifies the color used in the player's progress bar. =:
  • @controls@ := @0@, @1@ or @2@; initially set to @1@. Indicates whether the video player controls are displayed. =:
  • @disablekb@ := @0@ or @1@; initially set to @0@; Disables keyboard commands. =:
  • @enablejsapi@ := @0@ or @1@; initially set to @0@; Enables or disables "the javascript player api":https://developers.google.com/youtube/js_api_reference. =:
  • @end@ := Integer; initially not set. Specifies the time, measured in seconds, when the player should stop playing the video. =:
  • @fs@ := @0@ or @1@; initially set to @1@. Setting this parameter to 0 prevents the fullscreen button from displaying in the player. =:
  • @hl@ := ISO 639-1 two-letter language code or a fully specified locale; initially not set. Sets the player's interface language. =:
  • @iv_load_policy@ := @1@ or @3@; initially set to @1@. Setting the parameter's value to 1 causes video annotations to be shown by default. =:
  • @loop@ := @0@ or @1@; initially set to @0@. Causes the player to play the video again and again. =:
  • @modestbranding@ := @0@ or @1@; initially set to @0@. Lets you use a YouTube player that does not show a YouTube logo. =:
  • @origin@ := URL; initially not set. URL scheme (@http://@ or @https://@) and full domain of your host page. Required for @https://@ URL's; including it protects against malicious third-party JavaScript being injected into your page and hijacking control of your YouTube player. =:
  • @playlist@ := Comma separeted list of video id's; initially not set. A list of video id's to read after the one provided via the @video@ attribute. =:
  • @playsinline@ := Initially not set. Controls whether videos play inline or fullscreen in an HTML5 player on iOS. =:
  • @rel@ := @0@ or @1@; initially set to @1@. Indicates whether the player should show related videos when playback of the initial video ends. =:
  • @showinfo@ := @0@ or @1@; initially set to @1@. Whether to display the video informations or not. =:
  • @start@ := Integer; initially not set. Specifies the time (in seconds) when the video should start playing. =:
  • @theme@ := @dark@ or @light@; initially set to @dark@; Indicates whether the embedded player will display player controls (like a play button or volume control) within a dark or light control bar. This parameter has been deprecated for HTML5 players. =:

p(alert-block information). %(ui-icon ui-icon-info).% Some prefs/attributes may be deprecated for HTML5 players or overriden by the provider depending on several conditions. More informations on "this Youtube webpage":https://developers.google.com/youtube/player_parameters.

h3. oui_if_youtube vs oui_if_player

p. While the @txp:oui_if_player…</txp:oui_if_player>@ tag is able to check an URL against any URL from any extension related provider, the @txp:oui_if_youtube…</txp:oui_if_youtube>@ tag is a shortcut to check an URL against YouTube related URL schemes only. It is strictly equivalent to @<txp:oui_if_player provider="youtube">…</txp:oui_if_player>@.

Check the "oui_player":https://github.com/NicolasGraph/oui_player documentation for more informations.

h2. Examples

h3. Embed a player using the preference values

bc(language-markup). <txp:oui_player />

"oui_player":https://github.com/NicolasGraph/oui_player preference related field value: @https://youtu.be/9FWIG_c6PfI@.

h3. Embed a player by defining its provider and a media ID through attributes

bc(language-markup). <txp:oui_player provider="youtube" play="9FWIG_c6PfI" />

…or:

bc(language-markup). <txp:oui_youtube play="9FWIG_c6PfI" />

h3. Conditionally embed a player using attributes

bc(language-markup).. <txp:oui_if_player provider="youtube" play="https://www.youtube.com/watch?v=9FWIG_c6PfI"> <txp:oui_player /> </txp:oui_if_player>

p. …or:

bc(language-markup).. <txp:oui_if_youtube play="https://www.youtube.com/watch?v=9FWIG_c6PfI"> <txp:oui_youtube /> </txp:oui_if_youtube>

h2. Credits

h3. Author

"Nicolas Morand":https://twitter.com/NicolasGraph Thank you to the Textpattern community and the core team.

h3. License

This plugin is distributed under "GPL v2.0":https://www.gnu.org/licenses/gpl-2.0.txt.

oui_youtube version 1.0.0-BETA3, Copyright (C) 2018 Nicolas Morand This Textpattern plugin comes with ABSOLUTELY "NO WARRANTY":https://www.gnu.org/licenses/gpl-2.0.html#section11. This is free software, and you are welcome to redistribute it "under certain conditions":https://www.gnu.org/licenses/gpl-2.0.html#SEC3.

h3. Changelog

  • oui_youtube v1.0.0-BETA3 (2018-08-15) ** Added: @list@ support.
  • oui_player v1.3.0 (2017-05-24)