code: protected void setAdditionalAttributes(@Nullable HtmlElement<?> mediaElement, @NotNull Media media) {
      if (mediaElement == null) {
        return;
      }
      MediaArgs mediaArgs = media.getMediaRequest().getMediaArgs();
      for (Entry<String, Object> entry : mediaArgs.getProperties().entrySet()) {
        if (StringUtils.equals(entry.getKey(), MediaNameConstants.PROP_CSS_CLASS)) {
          mediaElement.addCssClass(entry.getValue().toString());
        }
        else {
          mediaElement.setAttribute(entry.getKey(), entry.getValue().toString());
        }
      }
    }
docs: Set additional attributes on the media element from the MediaArgs properties.
  @param mediaElement Media element
  @param media Media