addVideo

addVideo

BASIC / ADVANCED / PREMIUM

Inserts a video into the PowerPoint presentation.

Description
public addVideo($video, $position, $videoStyles = array(), $options = array())

This method inserts videos into the PowerPoint presentation.

Parameters

video

Video path. Video formats: avi, mkv, mp4, wmv.

position

Key Type Description
new array

A new position is generated.

  • 'coordinateX' (int) EMUs (English Metric Unit).
  • 'coordinateY' (int) EMUs (English Metric Unit).
  • 'sizeX' (int) EMUs (English Metric Unit).
  • 'sizeY' (int) EMUs (English Metric Unit).
  • 'name' (string) placeholder internal name. If not set, a random name is generated.
  • 'order' (int) set the display order. Default after existing contents. 0 is the first order position. If the order position doesn't exist add after existing contents.

videoStyles

Key Type Description
image array
  • 'image' (string) image to be used as preview. Set a default one if not set.
  • 'mime' (string) forces a mime (image/jpg, image/jpeg, image/png, image/gif, image/bmp, image/webp).
mime string Forces a mime (video/mp4, video/x-msvideo, video/x-ms-wmv, video/unknown).

options

Key Type Description
descr string Placeholder alt text (descr) value.
Exceptions

Video doesn't exist.

Video format is not supported.

Image doesn't exist.

Image format is not supported.

Position not valid.

Code samples

Example #1

The resulting PPTX looks like:

Release notes
  • phppptx 3.5:
    • descr option.
  • phppptx 1.0:
    • new method.