Use the Office dialog box to show a video
This article explains how to play a video in an Office Add-in dialog box.
This article presumes you're familiar with the basics of using the Office dialog box as described in Use the Office dialog API in your Office Add-ins.
To play a video in a dialog box with the Office dialog API, follow these steps.
Create a page containing an iframe and no other content. The page must be in the same domain as the host page. For a reminder of what a host page is, see Open a dialog box from a host page. In the
srcattribute of the iframe, point to the URL of an online video. The protocol of the video's URL must be HTTPS. In this article, we'll call this page "video.dialogbox.html". The following is an example of the markup.
<iframe class="ms-firstrun-video__player" width="640" height="360" src="https://www.youtube.com/embed/XVfOe5mFbAE?rel=0&autoplay=1" frameborder="0" allowfullscreen> </iframe>
Use a call of
displayDialogAsyncin the host page to open video.dialogbox.html.
If your add-in needs to know when the user closes the dialog box, register a handler for the
DialogEventReceivedevent and handle the 12006 event. For details, see Errors and events in the Office dialog box.
For a sample of a video playing in a dialog box, see the video placemat design pattern.