Aspose.Words insertOnlineVideo -> results in black box but no video

Hello, I’m using Aspose Words for Java (v23.5, via PHP) to insert a known YouTube video into a document.The code I am using is:

$doc = new java("com.aspose.words.Document");
$docBuilder = new java("com.aspose.words.DocumentBuilder",$doc);
$docBuilder->insertOnlineVideo("https://www.youtube.com/watch?v=rcZEqZ34ftY", 360, 270);
$doc->save("c:\temp\onlineVideo.docx");

When I run the code, the attached output is produced. There is a black box but apparently no player; it does not seem like the video is embedded.

onlineVideo.docx (8.2 KB)

If I open that document and use Insert->Online Video in Word with the exact same YouTube URL, the video inserts as expected. I would expect the Aspose-embedded video (top box) to look the same as the bottom box in this image.

Can you please advise if I need to do something different? Thank you.

@backprop I have tested the scenario on my side and video is inserted properly: out.docx (27.7 KB)

Document doc = new Document();
DocumentBuilder docBuilder = new DocumentBuilder(doc);
docBuilder.insertOnlineVideo("https://www.youtube.com/watch?v=rcZEqZ34ftY", 360, 270);
doc.save("c:\\temp\\out.docx");

However, I have managed to reproduce the problem is run the code with disabled internet connection. Please make sure internet connection is not restricted in the environment where the code is run.

Thanks Alexey. For anyone reading later: if you have to add allow rules to your company proxy or firewall, the method requires that internet access exists to both https://www.youtube.com as well as https://img.youtube.com to get the static screenshot images.

@backprop Thank you for sharing the information. It is perfect that you managed to resolve the problem.