Skip to main content

youtube-embed

Documentation / interface/youtube-embed

Interface​

embedYoutubePlayer()​

function embedYoutubePlayer(): YouTubePlayer;

Defined in: packages/ai-research-agent/src/interface/youtube-embed.js:68

Creates video player wrapping YouTube IFrame Player API in a div element with the specified ID.

Returns​

YouTubePlayer

An object containing the YouTube API functionality.

Example​

// <div id="player"></div>
const YT = embedYoutubePlayer();
new YT.Player('player', {
height: '360',
width: '640',
videoId: 'dQw4w9WgXcQ',
events: {
'onReady': onPlayerReady,
'onStateChange': null,
'onTimeChange': onTimeChange,
}
});
function onPlayerReady(event) {
event.target.playVideo();
}
function onTimeChange(time) {
console.log(time)
}

Other​

YouTubePlayer​

Defined in: packages/ai-research-agent/src/interface/youtube-embed.js:2

Properties​

PropertyTypeDescriptionDefined in

loadVideoById

Function

Loads a specified video.

packages/ai-research-agent/src/interface/youtube-embed.js:3

cueVideoById

Function

Cues a specified video.

packages/ai-research-agent/src/interface/youtube-embed.js:4

loadVideoByUrl

Function

Loads a video by URL.

packages/ai-research-agent/src/interface/youtube-embed.js:5

cueVideoByUrl

Function

Cues a video by URL.

packages/ai-research-agent/src/interface/youtube-embed.js:6

loadPlaylist

Function

Loads a playlist.

packages/ai-research-agent/src/interface/youtube-embed.js:7

cuePlaylist

Function

Cues a playlist.

packages/ai-research-agent/src/interface/youtube-embed.js:8

playVideo

Function

Plays the currently loaded video.

packages/ai-research-agent/src/interface/youtube-embed.js:9

pauseVideo

Function

Pauses the currently playing video.

packages/ai-research-agent/src/interface/youtube-embed.js:10

stopVideo

Function

Stops the currently playing video.

packages/ai-research-agent/src/interface/youtube-embed.js:11

seekTo

Function

Seeks to a specified time in the video.

packages/ai-research-agent/src/interface/youtube-embed.js:12

nextVideo

Function

Plays the next video in the playlist.

packages/ai-research-agent/src/interface/youtube-embed.js:13

previousVideo

Function

Plays the previous video in the playlist.

packages/ai-research-agent/src/interface/youtube-embed.js:14

playVideoAt

Function

Plays a specific video in the playlist.

packages/ai-research-agent/src/interface/youtube-embed.js:15

mute

Function

Mutes the player.

packages/ai-research-agent/src/interface/youtube-embed.js:16

unMute

Function

Unmutes the player.

packages/ai-research-agent/src/interface/youtube-embed.js:17

isMuted

Function

Checks if the player is muted.

packages/ai-research-agent/src/interface/youtube-embed.js:18

setVolume

Function

Sets the player volume.

packages/ai-research-agent/src/interface/youtube-embed.js:19

getVolume

Function

Gets the player volume.

packages/ai-research-agent/src/interface/youtube-embed.js:20

setSize

Function

Sets the player size.

packages/ai-research-agent/src/interface/youtube-embed.js:21

getPlaybackRate

Function

Gets the playback rate.

packages/ai-research-agent/src/interface/youtube-embed.js:22

setPlaybackRate

Function

Sets the playback rate.

packages/ai-research-agent/src/interface/youtube-embed.js:23

getAvailablePlaybackRates

Function

Gets available playback rates.

packages/ai-research-agent/src/interface/youtube-embed.js:24

setLoop

Function

Sets whether the player should loop playlists.

packages/ai-research-agent/src/interface/youtube-embed.js:25

setShuffle

Function

Sets whether playlists should be shuffled.

packages/ai-research-agent/src/interface/youtube-embed.js:26

getVideoLoadedFraction

Function

Gets the fraction of the video loaded.

packages/ai-research-agent/src/interface/youtube-embed.js:27

getPlayerState

Function

Gets the current player state.

packages/ai-research-agent/src/interface/youtube-embed.js:28

getCurrentTime

Function

Gets the current playback time.

packages/ai-research-agent/src/interface/youtube-embed.js:29

getDuration

Function

Gets the video duration.

packages/ai-research-agent/src/interface/youtube-embed.js:30

getVideoUrl

Function

Gets the URL of the current video.

packages/ai-research-agent/src/interface/youtube-embed.js:31

getVideoEmbedCode

Function

Gets the embed code for the current video.

packages/ai-research-agent/src/interface/youtube-embed.js:32

getPlaylist

Function

Gets the current playlist.

packages/ai-research-agent/src/interface/youtube-embed.js:33

getPlaylistIndex

Function

Gets the index of the current playlist item.

packages/ai-research-agent/src/interface/youtube-embed.js:34

addEventListener

Function

Adds an event listener.

packages/ai-research-agent/src/interface/youtube-embed.js:35

removeEventListener

Function

Removes an event listener.

packages/ai-research-agent/src/interface/youtube-embed.js:36

getIframe

Function

Gets the player iframe element.

packages/ai-research-agent/src/interface/youtube-embed.js:37

destroy

Function

Destroys the player instance.

packages/ai-research-agent/src/interface/youtube-embed.js:38