Support » Plugin: Video Embed & Thumbnail Generator » Extending WP REST API to include Additional Sizes

  • Resolved everrrettt

    (@everrrettt)


    Hi! Thanks for developing this plugin. I’m using WP as a headless CMS and relying on the the WP REST API to fetch content. Happy to see the additional video sizes are included in the Media response’s description.rendered data[1] (from the_content()) but it would be excellent if these were separated into their own object or array.

    I’ve started tinkering with extending the API myself but unsure what function from your plugin to use to retrieve the “Additional Formats” media (hopefully including their size and url at least).

    Any help much appreciated!

    [1] Default WP REST Media endpoint is /wp-json/wp/v2/media/${id}

    • This topic was modified 3 months, 3 weeks ago by  everrrettt.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Kyle Gilman

    (@kylegilman)

    The function kgvid_encodevideo_info($movieurl, $postID) is where I would start. It returns an array of information about the various formats available given a particular master video. $movieurl and $postID both refer to the same attachment, so the movieurl would be something like https://www.yoursite.com/wp-content/2019/07/video.mp4 and the postID would be the ID of that video, not the ID of a post the video might be embedded in.

    everrrettt

    (@everrrettt)

    Thanks, will try that!

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.