insertOnlineVideo method

insertOnlineVideo(videoUrl, width, height)

Inserts an online video object into the document and scales it to the specified size.

insertOnlineVideo(videoUrl: string, width: number, height: number)
ParameterTypeDescription
videoUrlstringThe URL to the video.
widthnumberThe width of the image in points. Can be a negative or zero value to request 100% scale.
heightnumberThe height of the image in points. Can be a negative or zero value to request 100% scale.

Remarks

You can change the image size, location, positioning method and other settings using the Shape object returned by this method.

Insertion of online video from the following resources is supported:

If your online video is not displaying correctly, use DocumentBuilder.insertOnlineVideo(), which accepts custom embedded html code.

The code for embedding video can vary between providers, consult your corresponding provider of choice for details.

Returns

The image node that was just inserted.

insertOnlineVideo(videoUrl, horzPos, left, vertPos, top, width, height, wrapType)

Inserts an online video object into the document and scales it to the specified size.

insertOnlineVideo(videoUrl: string, horzPos: Aspose.Words.Drawing.RelativeHorizontalPosition, left: number, vertPos: Aspose.Words.Drawing.RelativeVerticalPosition, top: number, width: number, height: number, wrapType: Aspose.Words.Drawing.WrapType)
ParameterTypeDescription
videoUrlstringThe URL to the video.
horzPosRelativeHorizontalPositionSpecifies where the distance to the image is measured from.
leftnumberDistance in points from the origin to the left side of the image.
vertPosRelativeVerticalPositionSpecifies where the distance to the image measured from.
topnumberDistance in points from the origin to the top side of the image.
widthnumberThe width of the image in points. Can be a negative or zero value to request 100% scale.
heightnumberThe height of the image in points. Can be a negative or zero value to request 100% scale.
wrapTypeWrapTypeSpecifies how to wrap text around the image.

Remarks

You can change the image size, location, positioning method and other settings using the Shape object returned by this method.

Insertion of online video from the following resources is supported:

If your online video is not displaying correctly, use DocumentBuilder.insertOnlineVideo(), which accepts custom embedded html code.

The code for embedding video can vary between providers, consult your corresponding provider of choice for details.

Returns

The image node that was just inserted.

insertOnlineVideo(videoUrl, videoEmbedCode, thumbnailImageBytes, width, height) {#string_string_number[]_number_number}

Inserts an online video object into the document and scales it to the specified size.

insertOnlineVideo(videoUrl: string, videoEmbedCode: string, thumbnailImageBytes: number[], width: number, height: number)
ParameterTypeDescription
videoUrlstringThe URL to the video.
videoEmbedCodestringThe embed code for the video.
thumbnailImageBytesnumber[]The thumbnail image bytes.
widthnumberThe width of the image in points. Can be a negative or zero value to request 100% scale.
heightnumberThe height of the image in points. Can be a negative or zero value to request 100% scale.

Remarks

You can change the image size, location, positioning method and other settings using the Shape object returned by this method.

Returns

The image node that was just inserted.

insertOnlineVideo(videoUrl, videoEmbedCode, thumbnailImageBytes, horzPos, left, vertPos, top, width, height, wrapType) {#string_string_number[]_relativehorizontalposition_number_relativeverticalposition_number_number_number_wraptype}

Inserts an online video object into the document and scales it to the specified size.

insertOnlineVideo(videoUrl: string, videoEmbedCode: string, thumbnailImageBytes: number[], horzPos: Aspose.Words.Drawing.RelativeHorizontalPosition, left: number, vertPos: Aspose.Words.Drawing.RelativeVerticalPosition, top: number, width: number, height: number, wrapType: Aspose.Words.Drawing.WrapType)
ParameterTypeDescription
videoUrlstringThe URL to the video.
videoEmbedCodestringThe embed code for the video.
thumbnailImageBytesnumber[]The thumbnail image bytes.
horzPosRelativeHorizontalPositionSpecifies where the distance to the image is measured from.
leftnumberDistance in points from the origin to the left side of the image.
vertPosRelativeVerticalPositionSpecifies where the distance to the image measured from.
topnumberDistance in points from the origin to the top side of the image.
widthnumberThe width of the image in points. Can be a negative or zero value to request 100% scale.
heightnumberThe height of the image in points. Can be a negative or zero value to request 100% scale.
wrapTypeWrapTypeSpecifies how to wrap text around the image.

Remarks

You can change the image size, location, positioning method and other settings using the Shape object returned by this method.

Returns

The image node that was just inserted.

Examples

Shows how to insert an online video into a document using a URL.

let doc = new aw.Document();
let builder = new aw.DocumentBuilder(doc);

builder.insertOnlineVideo("https://youtu.be/g1N9ke8Prmk", 360, 270);

// We can watch the video from Microsoft Word by clicking on the shape.
doc.save(base.artifactsDir + "DocumentBuilder.InsertVideoWithUrl.docx");

Shows how to insert an online video into a document.

let doc = new aw.Document();
let builder = new aw.DocumentBuilder(doc);

let videoUrl = "https://vimeo.com/52477838";

// Insert a shape that plays a video from the web when clicked in Microsoft Word.
// This rectangular shape will contain an image based on the first frame of the linked video
// and a "play button" visual prompt. The video has an aspect ratio of 16:9.
// We will set the shape's size to that ratio, so the image does not appear stretched.
builder.insertOnlineVideo(videoUrl, aw.Drawing.RelativeHorizontalPosition.LeftMargin, 0,
  aw.Drawing.RelativeVerticalPosition.TopMargin, 0, 320, 180, aw.Drawing.WrapType.Square);

doc.save(base.artifactsDir + "DocumentBuilder.insertOnlineVideo.docx");

See Also