Skip to main content

VideoMetaDataMap

What's the videoMetaDataMap?​

The videoMetaDataMap is a DivaBOWebAdapter parameter you can value with an async function that

  • Receives the VideoMetadata within the videoMetadata object
  • Can modify the videoMetadata properties value
  • Returns the videoMetadata object

Value the videoMetaDataMap parameter when

  • You need to get some videoMetadata properties' value to implement front-end business logic.
  • You need to alter runtime some videoMetadata properties' value.

Sample code​

import { AssetState, BoAdapterWebComponentProps, DivaWebBoAdapter, VideoMetadata } from "@deltatre-vxp/diva-sdk/diva-web-bo-adapter";
import "@deltatre-vxp/diva-sdk/diva-web-sdk/index.min.css";
import { useState } from "react";

const videoId = "<videoId>";

const libs = {
mux: "https://cdnjs.cloudflare.com/ajax/libs/mux.js/6.2.0/mux.min.js",
shaka: "https://cdnjs.cloudflare.com/ajax/libs/shaka-player/4.11.2/shaka-player.compiled.js",
hlsJs: "https://cdn.jsdelivr.net/npm/hls.js@1.5.7",
googleIMA: false,
googleDAI: false,
googleCast: false,
threeJs: false
};

const config = {
videoId: videoId,
libs: libs,
};

function App() {
const [isVideoLive, setIsVideoLive] = useState(false);
const props: BoAdapterWebComponentProps = {
settingsUrl: "<settings URL>",
languageCode: "en-US",
languageDictionary: "en-US",
onDivaBoAdapterError: console.error,
config: config,
videoMetadataMap: async (vd: VideoMetadata) => {
//read/write videoMetadata properties and implement your front-end business logic <---
return vd;
}
}

return (
<>
<DivaWebBoAdapter {...props} />
</>
);
}