Adding Video, Audio, and Embedded HTML Resources in DITA Topics

You can insert references to media resources (such as videos, audio clips, or embedded HTML frames) in your DITA topics. The media resources can be played directly in Author mode and in all HTML5-based outputs. There is a toolbar button () that allows you to insert and configure a reference to the media resource.

Adding a Media Resource

To insert a media resource in a DITA document, use the following procedure:

  1. Place the cursor at the location where you want the media resource.
  2. Select the Insert Media Resource action from the toolbar. The Insert Media dialog box appears.

    Insert Media Dialog Box

  3. Configure the options in this dialog box and click Insert.

    The Insert Media dialog box includes the following options:

    URL
    Use this option to specify a URL for a media resource. It will insert the URL as the value of a data attribute of an object element. You can type the URL of the resource you want to insert or use the Browse drop-down menu to select it.
    Keyref
    You can use the Choose Key Reference button to open the Choose Key dialog box that presents the list of keys available in the selected root map. Use this dialog box to insert the selected key as the value of the datakeyref attribute of an object element. All keys that are presented in the dialog box are gathered from the root map of the current DITA map.

    Tip

    If your defined keys are not listed in this dialog box, it is most likely trying to gather keys from the wrong root map. You can change the root map by using the Change Root Map link.
    Type
    Oxygen XML Editor detects and automatically selects the media type based upon the specified resource in the URL field. You can manually change the type, but keep in mind that in the publishing stage the object element is converted to an HTML5 element based upon the type selected here. You can choose between: audio, video, or iframe.
    Size
    Use this section to configure the Width and Height of the frame for the media resource. Specifying a value in these options inserts a width and height attribute, respectively. For audio clips, only the Width can be adjusted.

Result in Author Mode: A reference to the specified video, audio, or embedded HTML frame is inserted in an object element and it is rendered in Author mode so that it can be played directly from there.

Result in Output: In the publishing stage, the object element is converted to an HTML5 element so that it can be rendered properly and played in all HTML5-based outputs.

  • Videos - The object element is converted to an HTML5 video element.
  • Audio Clips - The object element is converted to an HTML5 audio element.
  • Embedded HTML Frames - The object element is converted to an HTML5 iframe element.

Tip

There is an even faster way of inserting an embedded video (such as a YouTube or Vimeo). If you copy the embed code from the source (for example, you can right-click on a YouTube video and select Copy embed code), you can then paste the contents of the clipboard in the URL field, and the Type will automatically be set on iframe, while the Width and Height will be populated according to the detected size.

Was this helpful?