Skip to content

genVideoID

Carlos Alba edited this page Nov 21, 2020 · 1 revision

genVideoID

Is a function that takes in a youtube url like 'https://www.youtube.com/watch?v=eIMR82oO2Dc' and takes the ID from it leaving you with a YTID value like 'eIMR82oO2Dc'

Here is an example of usage where the component takes a YTID from the genVideoID function to fetch more data from youtube.com

  <Component
  source={`https://www.youtube.com/embed/${genVideoID(nullthrows(source))}`}
  />
Clone this wiki locally