Skip to main content

Module Methods

getYoutubeMeta#

getYoutubeMeta(videoId: String): Promise[youtubeMeta]

Fetch metadata of a youtube video using the oEmbed Spec - https://oembed.com/#section7

metadata returned -

fieldtypeexplanation
author_nameStringThe name of the author/owner of the video.
author_urlStringyoutube channel link of the video.
heightNumberThe height in pixels required to display the HTML.
htmlStringThe HTML required to embed a video player.
provider_nameStringThe name of the resource provider.
provider_urlStringThe url of the resource provider.
thumbnail_heightNumberThe height of the video thumbnail.
thumbnail_urlStringThe url of the resource provider.
thumbnail_widthNumberThe width of the video thumbnail.
titleStringyoutube video title.
typeStringThe oEmbed version number.
versionStringThe resource type.
widthNumberThe width in pixels required to display the HTML.

example -

import {Alert} from 'react-native';import {getYoutubeMeta} from 'react-native-youtube-iframe';
getYoutubeMeta('sNhhvQGsMEc').then(meta => {  Alert.alert('title of the video : ' + meta.title);});