video
The primary video of the page as a direct, playable asset:
const { url, type } = await microlink.video('https://vimeo.com/76979871')It resolves to an asset object with
url, type, duration, duration_pretty, width, height, size, and size_pretty, or null when no video is detected. The URL is in a browser-friendly format, so it can be embedded directly:const video = await microlink.video('https://www.youtube.com/watch?v=9P6rdqiybaw')
console.log(video.type) // 'mp4'
console.log(video.duration_pretty) // '9m'
console.log(video.width, video.height) // 1280 720It has no method-specific options; the shared options apply. See the video parameter for the detection details.
Examples
Render the detected video with a poster image from the same page:
const [video, { image }] = await Promise.all([
microlink.video(url),
microlink.metadata(url)
])
player.src = video.url
player.poster = image.urlOr get both in one request by asking metadata for the video field:
const { image, video } = await microlink.metadata(url, { video: true })