Customizing Media JSON in Cincopa
Cincopa allows you to dynamically update the media JSON for videos by using the on-media-json
callback. This allows you to modify properties like the video URL, aspect ratio, storyboard URL, and thumbnail URL during runtime.
How to Customize Media JSON
To modify the media JSON for a specific video, you can use the following script. This script lets you update the video source (m3u8
), aspect ratio, storyboard URL, and thumbnail URL dynamically.
Example:
<script type="text/javascript">
var cincopa = cincopa || {};
cincopa.registeredFunctions = cincopa.registeredFunctions || [];
cincopa.registeredFunctions.push(
{
"func": function (name, data, gallery_data) {
gallery_data.MediaJSON.items[0].m3u8 = "http://nasatv-lh.akamaihd.net/i/NASA_101@319270/master.m3u8";
gallery_data.MediaJSON.items[0].aspect_ratio = "1.75";
gallery_data.MediaJSON.items[0].storyboard_url = ""; // set to empty
gallery_data.MediaJSON.items[0].thumbnail_url = "https://image.ibb.co/fxZC6L/download.png"; // custom thumbnail
},
"filter": "runtime.on-media-json"
});
</script>