# Video

> Add and control videos with Aspose.Slides for Node.js: insert, play, trim, set poster frames, and export with examples for PPT, PPTX, and ODP presentations.

Source: https://docs.aspose.com/slides/nodejs-java/examples/elements/video/
Updated: 2026-08-05


This article demonstrates how to embed video frames and set playback options using **Aspose.Slides for Node.js via Java**.

## **Add a Video Frame**

Add a video frame to a slide.

```js
var aspose = aspose || {};
aspose.slides = require("aspose.slides.via.java");

function addVideo() {
    let presentation = new aspose.slides.Presentation();
    try {
        let slide = presentation.getSlides().get_Item(0);

        // Add a video.
        let videoFrame = slide.getShapes().addVideoFrame(50, 50, 320, 240, "video.mp4");

        presentation.save("video.pptx", aspose.slides.SaveFormat.Pptx);
    } finally {
        presentation.dispose();
    }
}
```

## **Access a Video Frame**

Retrieve the first video frame added to a slide.

```js
var aspose = aspose || {};
aspose.slides = require("aspose.slides.via.java");
const java = require("java");

function accessVideo() {
    let presentation = new aspose.slides.Presentation("video.pptx"); 
    try { 
        let slide = presentation.getSlides().get_Item(0);

        // Access the first video frame on the slide.
        let firstVideo = null;
        for (let i = 0; i < slide.getShapes().size(); i++) {
            let shape = slide.getShapes().get_Item(i);
            if (java.instanceOf(shape, "com.aspose.slides.IVideoFrame")) {
                firstVideo = shape;
                break;
            }
        }
    } finally {
        presentation.dispose();
    }
}
```

## **Remove a Video Frame**

Delete a video frame from the slide.

```js
var aspose = aspose || {};
aspose.slides = require("aspose.slides.via.java");

function removeVideo() {
    let presentation = new aspose.slides.Presentation("video.pptx");
    try {
        let slide = presentation.getSlides().get_Item(0);

        // Assume the first shape is the video frame.
        let videoFrame = slide.getShapes().get_Item(0);

        // Remove the video frame.
        slide.getShapes().remove(videoFrame);

        presentation.save("video_removed.pptx", aspose.slides.SaveFormat.Pptx);
    } finally {
        presentation.dispose();
    }
}
```

## **Set Video Playback**

Configure the video to play automatically when the slide is displayed.

```js
var aspose = aspose || {};
aspose.slides = require("aspose.slides.via.java");

function setVideoPlayback() {
    let presentation = new aspose.slides.Presentation("video.pptx");
    try {
        let slide = presentation.getSlides().get_Item(0);

        // Assume the first shape is the video frame.
        let videoFrame = slide.getShapes().get_Item(0);

        // Configure the video to play automatically.
        videoFrame.setPlayMode(aspose.slides.VideoPlayModePreset.Auto);

        presentation.save("video_autoplay.pptx", aspose.slides.SaveFormat.Pptx);
    } finally {
        presentation.dispose();
    }
}
```



## Related articles

- [Audio](https://docs.aspose.com/slides/nodejs-java/examples/elements/audio/)
- [Manage Video Frames in Presentations Using JavaScript](https://docs.aspose.com/slides/nodejs-java/video-frame/)
- [Manage Audio in Presentations Using JavaScript](https://docs.aspose.com/slides/nodejs-java/audio-frame/)