DocumentBuilderInsertOnlineVideo Method (String, Double, Double)
Inserts an online video object into the document and scales it to the specified size.

Namespace: Aspose.Words
Assembly: Aspose.Words (in Aspose.Words.dll) Version: 19.10
Syntax
public Shape InsertOnlineVideo(
	string videoUrl,
	double width,
	double height
)

Parameters

videoUrl
Type: SystemString
The URL to the video.
width
Type: SystemDouble
The width of the image in points. Can be a negative or zero value to request 100% scale.
height
Type: SystemDouble
The height of the image in points. Can be a negative or zero value to request 100% scale.

Return Value

Type: Shape
The image node that was just inserted.
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:

  • https://www.youtube.com/
  • https://vimeo.com/

If your online video is not displaying correctly, use InsertOnlineVideo(String, String, Byte, Double, Double), which accepts custom embedded html code.

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

Examples
Show how to insert online video into a document using video url
[C#]

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

// Pass direct url from youtu.be.
String url = "https://youtu.be/t_1LYZ102RA";

double width = 360;
double height = 270;

builder.InsertOnlineVideo(url, width, height);
See Also