Skip to main content


Media enables the addition of audio, video and online video to Slides.


// Path: full or relativeslide.addMedia({ type: "video", path: "" });slide.addMedia({ type: "video", path: "../media/" });
// Base64: pre-encoded stringslide.addMedia({ type: "audio", data: "audio/mp3;base64,iVtDafDrBF[...]=" });
// YouTube: Online video (supported in Microsoft 365)slide.addMedia({ type: "online", link: "" });

Usage Notes#

Either provide a URL location or base64 data along with type to create media.

  • type - type: media type
  • path - URL: relative or full
  • data - base64: string representing an encoded image

Supported Formats and Notes#

  • Video (mpg, mov, mp4, m4v, et al.); Audio (mp3, wav, et al.); (see Video and Audio file formats supported in PowerPoint)
  • YouTube videos can be viewed using Microsoft 365/Office 365 (they may show errors on older desktop PowerPoint versions)
  • Other online video sites may be supported as well (some users have reported non-YouTube sites that worked)
  • Not all platforms support all formats! MacOS can show MPG files whereas Windows probably will not, and some AVI files may work and some may not. Video codecs are weird and painful like that.


Position/Size Props (PositionProps)#

OptionTypeDefaultDescriptionPossible Values
xnumber1.0hor location (inches)0-n
xstringhor location (percent)'n%'. (Ex: {x:'50%'} middle of the Slide)
ynumber1.0ver location (inches)0-n
ystringver location (percent)'n%'. (Ex: {y:'50%'} middle of the Slide)
wnumber1.0width (inches)0-n
wstringwidth (percent)'n%'. (Ex: {w:'50%'} 50% the Slide width)
hnumber1.0height (inches)0-n
hstringheight (percent)'n%'. (Ex: {h:'50%'} 50% the Slide height)

Data/Path Props (DataOrPathProps)#

OptionTypeDescriptionPossible Values
datastringimage data (base64)(data or path is required) base64-encoded image string.
pathstringimage path(data or path is required) relative or full URL

Media Props (MediaProps)#

OptionTypeDescriptionPossible Values
typestringmedia typemedia type: audio or video (reqs: data or path) or online (reqs:link)
coverstringcover imagebase64 encoded string of cover image
extnstringmedia extensionuse when the media file path does not already have an extension, ex: "/folder/SomeSong"
linkstringvideo URL(YouTube only): link to online video


Media Examples


Sample code: demos/modules/demo_media.mjs