Formatting XML Data to Import into HMP with Media Files
Haivision Media Platform supports importing HMP XML files while editing existing assets or assets that are in the process of being imported. Metadata imported from the HMP XML file completely overwrites the existing asset metadata.
The following table describes the handling of various HMP XML elements. Elements that are described as optional may be left out of the XML file and the corresponding record on the asset is left as is.
Element | Required | Notes |
---|---|---|
id | Ignored | The original asset UUID is always preserved. |
title | Optional | When no title is specified, the video filename is used. |
description | Optional | Plain text description with all HTML tags removed. |
htmlDescription | Optional | The description with HTML tags and embedded images. |
ctime | Optional | The source creation time in Unix timestamp (seconds). |
mtime | Ignored | The source's last modified time in Unix timestamp (seconds). Importing an HMP XML file updates the asset's mtime to the present. |
duration | Ignored | Duration of the asset is calculated by HMP. |
metadata | Optional | If missing, metadata and HotMarks on the asset are left as is. If included, all metadata including HotMarks is overwritten with the new data. |
media | Ignored | HMP already has internal records of the asset's tracks and posters. |
Categories
Category values from an HMP XML file are added to an asset's metadata even when that category does not exist on the importing system.
The HMP system from which the HMP XML file was exported may not have the same metadata and metadata values as the system to which it is imported. After importing metadata values to a system that does not have the corresponding metadata, the following behaviors can be observed:
- The exported system's metadata and values do not show up on imported asset's Edit Metadata pane.
- The exported system's metadata values show up on the REST API at
/assets/:id/metadata
. - Editing the imported asset's metadata values through the Web interface works and does not cause the imported XML metadata values to be deleted.
- When metadata with the same label as the metadata from the imported XML is created, the metadata and the selected values become visible on the imported asset's Edit Metadata pane.
- All metadata values from the imported XML are preserved even when "Custom Values" or "Multiple Values" is not enabled for metadata with the same name, and these values are still preserved when editing values from the Edit Metadata Pane.
Other Metadata
HMP XML import does not check whether other metadata makes valid references on the new system.
calypso:recorded_from_session
– If the session does not exist, it no longer shows up as a related asset on any session.calypso:creator
– If the creator does not exist, it does not show up under the "Mine" Browse Content filter for anyone.calypso:expiration_timestamp
calypso:recordGeoaddress
calypso:recordGeolocation
HotMarks
If the HotMark timestamp described in HMP XML is greater than the duration of the asset to which it is imported, an error is returned and the XML import fails. However, if the asset does not have a duration, the XML import succeeds. This can happen when the asset itself is still being imported and no duration can be calculated yet. If the resulting imported asset has a duration less than the HotMark, then that HotMark timestamp is not visible on the player, but appears in the /assets/:id/hotmarks
API.
Example HMP XML File
<asset xmlns="http://xml.haivision.com/calypso" version="1.0">
<id>a38d140c-2f21-4d14-a1f4-4bee069d5014</id>
<title>Food TV</title>
<description>Rachel Ray and a refrigerator</description>
<ctime>1391542482</ctime>
<mtime>1391542540</mtime>
<duration>10868</duration>
<metadata>
<entry>
<name>calypso:creator</name>
<field>
<type>STRING</type>
<value>haiadmin</value>
</field>
</entry>
<entry>
<name>calypso:recorded_from_session</name>
<field>
<type>STRING</type>
<value>a849de4a-f588-4904-b119-0ff53fda8cae</value>
</field>
</entry>
<entry>
<name>calypso:recordGeoaddress</name>
<field>
<type>STRING</type>
<value>4445 Rue Garand:Montréal:QC:H4R2H9:Saint-Laurent:Rue Garand:4445:Canada</value>
</field>
</entry>
<entry>
<name>calypso:recordGeolocation</name>
<field>
<type>STRING</type>
<value>+45.4913235,-73.7214226</value>
</field>
</entry>
<entry>
<name>calypso:category:keywords</name>
<field>
<type>STRING</type>
<value>Rachel Ray</value>
</field>
<field>
<type>STRING</type>
<value>Food</value>
</field>
<field>
<type>STRING</type>
<value>Refrigerator</value>
</field>
</entry>
<entry>
<name>calypso:htmlDescription</name>
<field>
<type>STRING</type>
<value><b>Test</b><div><img src= "data:image/jpeg;base64,/9j/4Q5.....</value>
</field>
</entry>
</metadata>
<media>
<movie>
<index>0</index>
<name>a38d140c-2f21-4d14-a1f4-4bee069d5014-1.mp4</name>
<format>mp4</format>
</movie>
<poster>
<index>0</index>
<name>a38d140c-2f21-4d14-a1f4-4bee069d5014.png</name>
<format>PNG</format>
</poster>
</media>
</asset>