Alex_Halynskyi
Apr 16, 2025Copper Contributor
Status:
New
Support for Inserting Media Elements via PowerPoint.ShapeCollection.addMediaElement API
We are developing a PowerPoint Office.js add-in and would like to request enhanced API support for working with media files (such as audio and video) in presentations.
Currently, the PowerPoint JavaScript API allows us to insert text boxes via the following method:
addTextBox(text, options): PowerPoint.Shape
This is extremely helpful for managing text-based content, but there is no equivalent method for adding media files programmatically.
Proposed Enhancement
We suggest extending the PowerPoint.ShapeCollection class with a new method:
addMediaElement(mediaUrl, options?): PowerPoint.Shape
Parameters:
- mediaUrl (string): The publicly accessible or base64-encoded URL to the media file.
- options (object, optional): Additional options such as:
- mediaType: "audio" | "video"
- left, top, height, width: Placement and sizing of the media on the slide.
- autoplay: boolean
- loop: boolean
Returns:
- A PowerPoint.Shape object representing the inserted media file (video/audio), allowing further manipulation (e.g., move, resize, delete).
Use Case:
In our add-in, we dynamically generate slide content based on user input, and part of that workflow includes inserting media. Currently, we are blocked by the lack of a native API method to insert video/audio.
We believe this functionality would be extremely valuable for a wide range of educational, corporate, and accessibility-related add-ins.
Thank you for considering this enhancement to the PowerPoint JavaScript API.
No CommentsBe the first to comment