Source YouTube information without an API key using the oEmbed endpoint 📺
Are you stuck on a reef in the sharky waters around the Gatsby islands? Check out 1-on-1 Emergency Gatsby Call with Queen Raae to get friendly advice you can put into action immediately from a seasoned Gatsby developer.
Learn how to get the most out of Gatsby and stay updated on the plugin by subscribing to daily emails from Queen Raae and Cap'n Ola.
npm install @raae/gatsby-source-youtube-oembed
or
yarn add @raae/gatsby-source-youtube-oembed
module.exports = {
plugins: [
`@raae/gatsby-source-youtube-oembed`
],
}
Add the YouTube ids for the videos you would like to source!
Type: An array of YouTube ids
Example: ["Bk1jonYPFD4", "TzJfepDjpzM"]
Default: []
// gatsby.config.js
module.exports = {
plugins: [
{
resolve: "@raae/gatsby-source-youtube-oembed",
options: {
youTubeIds: ["Bk1jonYPFD4", "TzJfepDjpzM"],
},
},
],
};
Time to wait between fetching fresh oEmbed data.
Type: Time in milliseconds
Example: 60000
Default(dev): 60000 * 5
(5 minutes)
Default(prod): 0
// gatsby.config.js
module.exports = {
plugins: [
{
resolve: "@raae/gatsby-source-youtube-oembed",
options: {
refreshInterval: 60000,
},
},
],
};
If you have any questions, feedback or suggestions head on over to discussions.
If you find a bug please open an issue and/or create a pull request to fix it.