Skip to content

Youtube Player

Category Requires Version
Google API 21, Android 5.0 Lollipop 2

Overview

A visible component that plays YouTube videos.
Note: For this component to work correctly, set the MIN API to 17 (Android 4.2).

Permissions

Events

Error

Use this event to detect that there was any error with the player. Return values: 'UNKNOWN', 'INVALID_PARAMETER_IN_REQUEST', 'HTML_5_PLAYER', 'VIDEO_NOT_FOUND', 'VIDEO_NOT_PLAYABLE_IN_EMBEDDED_PLAYER', 'INVALID_VOLUME' or 'INVALID_SEEK_TO'.

Params
error Text

Fullscreen

Event to get notified when the player enters or exits fullscreen. The variable 'fullscreen' returns true or false.

Params
fullscreen Boolean

Initialized

Use this event to start the playing of a normal or instant youtube video.

Playback Quality Changed

Use this event to detect that the playback quality was changed. Return values: 'UNKNOWN', 'SMALL', 'MEDIUM', 'LARGE', 'HD720', 'HD1080', 'HIGH_RES' or 'DEFAULT'.

Params
quality Text

Playback Rate Changed

Use this event to detect that the playback rate was changed. Return values: 'UNKNOWN', 'RATE_0_25', 'RATE_0_5', 'RATE_1', 'RATE_1_5' or 'RATE_2'.

Params
rate Text

State Changed

Use this event to detect that the state changes. Return values: 'UNKNOWN', 'UNSTARTED', 'ENDED', 'PLAYING', 'PAUSED', 'BUFFERING' or 'VIDEO_CUED'.

Params
state Text

Methods

Enter Fullscreen

Enter the video in fullscreen mode.

Exit Fullscreen

Exit the video from fullscreen mode.

Get Thumbnail From Video Id

Returns: Text

This block will return the thumbnail image path from a video id. Use only as example '_bZj-LOXdH8' from a youtube video.

Params
video Id Text

Instant Load

Use this block together with the 'Youtube Player' Initialized event. Loads and automatically plays the specified youtube video. Use only as example '_bZj-LOXdH8' from a youtube video.

Params
video Id Text

Load

Loads the specified video's thumbnail and prepares the player to play the video. Does not automatically play the video. Use only as example '_bZj-LOXdH8' from a youtube video.

Params
video Id Text

Pause

Pause the youtube video.

Play

Plays the youtube video.

Seek To

Set a position where the youtube video should start playing in seconds.

Params
position Number

Toggle Fullscreen

Toggle the state of the video player.

Properties

Enable Live Video UI

Boolean Default: False ➖ Read Write - Designer Blocks

If you want to play live videos you must setup the UI accordingly, by calling this method. If enabled, the user can not select a second on the video progress bar.

Get Current Second

Number ➖ Read - Blocks

Returns the current second.

Get Video Duration

Number ➖ Read - Blocks

Returns the video duration in seconds.

Height

Number ➖ Read Write - Blocks

Specifies the component's vertical height, measured in pixels.

Height Percent

Number ➖ Write - Blocks

Specifies the component's vertical height as a percentageof the height of its parent Component.

Is Fullscreen

Boolean ➖ Read - Blocks

Returns true if the player is in fullscreen mode.

Start Second

Number Default: 0 ➖ Read Write - Designer Blocks

The time from which the video should start playing.

Test Video Id

Text ➖ Read - Blocks

Use this block to test the youtube player. Powered by Kodular.io

Visible

Boolean Default: True ➖ Read Write - Designer Blocks

Returns true iff the component is visible.

Volume

Number Default: 50 ➖ Read Write - Designer Blocks

Set the volume to a number between 0 and 100.Use only integer numbers.

Width

Number ➖ Read Write - Blocks

Specifies the component's horizontal width, measured in pixels.

Width Percent

Number ➖ Write - Blocks

Specifies the component's horizontal width as a percentageof the Width of its parent Component.


Last update: November 9, 2022