Media Library - Gallery View
Before you start
To get a quick overview of what are the prerequisites of embedding VIDIZMO widgets, see: How to Integrate VIDIZMO Widgets.
Embedding the Media Gallery Widget
The following code will display Media Library - Gallery View widget
<vdz-mashup-gallery data-widget="true" id= "gallery"> </vdz-mashup-gallery>
Note: Make sure data-widget is set to true
as this applies the VIDIZMO default styling to the widget.
The Media Gallery widget has multiple events that are triggered on the various status and lifecycle changes. Following code examples explain how to utilize event listeners to subscribe to these events.
<script>
document.getElementById("gallery").addEventListener("on-mashups-loading", (event) => {
event.details.mashupSearchCriteria
});
document.getElementById("gallery").addEventListener("on-mashups-loaded", (event) => {
console.log(event);
console.log("onMashupLoaded")
});
document.getElementById("gallery").addEventListener("on-mashups-loading-failed", (event) => {
console.log(event);
console.log("onMashupLoadingFailed")
});
</script>
Output Events for Media Library Gallery View Widget
{ t: number, mashupInfo: MashupInfo}
Input properties for Media Library Gallery View Widget
Methods for Media Library Gallery View Widget
Sample Code - VIDIZMO Media Library Gallery Widget
<html>
<head>
<meta charset="UTF-8" />
< !--VIDIZMO Imports-- >
<script type="text/javascript" src="{portal-address}/static/js/vidizmo-player/player.js" >
</script>
<link rel="stylesheet" href="{portal-address}/static / compiled / widget / widgets.css " />
<script type="text / javascript " src=" {portal-address}/static/compiled / widget / widgets.js ">
</script>
</head>
<body style="margin: 20 px;">
<vdz-mashup-gallery id="gallery " data-widget="true " page-size-md="4"
search-criteria={
"sortType ":" ASC ",
"pageSize ":36,
"isGlobal ":true,
"showOnChannelLibrary ":true,
"isFeatured ":true
} >
</vdz-mashup-gallery>
<script>
document.getElementById("gallery").addEventListener("on-mashups-loading", (event) =>
{console.log(event);
console.log("onMashupLoading");
});
document.getElementById("gallery ").addEventListener("on-mashups-loaded", (event) =>
{console.log(event);
console.log("onMashupLoaded");
});
document.getElementById("gallery ").addEventListener("on-mashups-loading-failed", (event) =>
{console.log(event);
console.log("onMashupLoadingFailed");
});
</script>
</body>
</html >
Additional Widget(s) Integration
You can also add the following widgets with the Media Gallery View Widget.
1. Adding the Category Filter Widget
The following code will integrate the category filter widget with Media Gallery View Widget.
<vdz-library-filter id="widgetLibraryFilter" data-widget="true"> </vdz-library-filter>
The screenshot below shows the Category Filter Widget.
Note: The category filter widget is not a standalone widget and requires the Media Library Gallery View/Detail view widget to work.
Input Properties for Category Filter Widget:
Method(s) for Category Filter Widget:
Output Event(s) for Category Filter Widget:
Sample Code for Media Library Gallery View with Category Filter Widget
<html>
<head>
<meta charset="UTF-8" />
< !--VIDIZMO Imports-- >
<script type="text/javascript" src="{portal-address}/static/js/vidizmo-player/player.js" > </script>
<link rel="stylesheet" href="{portal-address}/static/compiled/widget/widgets.css" />
<script type="text/javascript" src=" {portal-address}/static/compiled/widget/widgets.js ">
</script>
</head>
<body style="margin: 20 px;">
<vdz-category-filter id="widgetCategoryFilter " data-widget="true ">
</vdz-category-filter>
<vdz-mashup-gallery id="gallery " data-widget="true " page-size-md="4"
search-criteria={"sortType":"ASC",
"pageSize":36,
"isGlobal":true,
"showOnChannelLibrary ":true,
"isFeatured ":true
}>
</vdz-mashup-gallery>
<script>
document.getElementById("widgetCategoryFilter").addEventListener("on-filter", (event) =>
{console.log(event);
});
document.getElementById("gallery").addEventListener("on-mashups-loading", (event) =>
{console.log(event);
console.log("onMashupLoading");
});
document.getElementById("gallery").addEventListener("on-mashups-loaded", (event) =>
{console.log(event);
console.log("onMashupLoaded");
});
document.getElementById("gallery").addEventListener("on-mashups-loading-failed", (event) =>
{console.log(event);
console.log("onMashupLoadingFailed")
});
</script>
</body>
</html>
2. Adding the Library Filter Widget
Step 1: The following code will integrate the library filter widget with the Gallery view widget
<vdz-library-filter data-widget="true" id="widgetLibraryFilter"></vdz-library-filter>
The screenshot below shows the Library Filter Widget.
Note: The Library filter widget is not a standalone widget and requires the Media Library Gallery View/Detail View widget to work.
Input Properties for Library Filter Widget:
Output Events for Library Filter Widget:
Note: You must have at least one of the aforementioned events within your VIDIZMO portal to be able to see that within the widget. You won't be able to see these events otherwise.
Sample Code for Media Library Gallery View with Library Filter Widget:
<html>
<head>
<meta charset="UTF-8" />
<!--VIDIZMO Imports-->
<script type="text/javascript" src="{portal-address}/static/js/vidizmo-player/player.js" >
</script>
<link rel="stylesheet" href="{portal-address}/static/compiled/widget/widgets.css" />
<script type="text/javascript" src="{portal-address}/static/compiled / widget / widgets.js ">
</script>
</head>
<body style="margin: 20 px;">
<vdz-category-filter id="widgetCategoryFilter " data-widget="true ">
</vdz-category-filter>
<vdz-mashup-gallery id="gallery " data-widget="true " page-size-md="4 "
search-criteria={"sortType":"ASC",
"pageSize":36,
"isGlobal":true,
"showOnChannelLibrary":true,
"isFeatured ":true
}>
</vdz-mashup-gallery>
<script>
document.getElementById("widgetLibraryFilter").addEventListener("on-filter", (event) =>
{console.log(event);
});
document.getElementById("gallery ").addEventListener("on-mashups-loading", (event) =>
{console.log(event);
console.log("onMashupLoading");
});
document.getElementById("gallery ").addEventListener("on-mashups-loaded", (event) =>
{console.log(event);
console.log("onMashupLoaded");
});
document.getElementById("gallery ").addEventListener("on-mashups-loading-failed", (event) =>
{console.log(event);
console.log("onMashupLoadingFailed")
});
</script>
</body>
</html>
3. Media Search Widget
Step 1: The following code will integrate the media search widget with the gallery view widget.
<vdz-mashup-filter show-search-box="true" show-forced-refresh-icon="true" data-widget="true"> </vdz-mashup-filter>
The screenshot below shows the Library Filter Widget.
Note: The Media Search widget is not a standalone widget and requires the Media Library Detail/Gallery widget to work.
Input Properties for Media Search Widget
Sample Code for Media Library Gallery with Media Search Widget:
<html>
<head>
<meta charset = "UTF-8" />
< !--VIDIZMO Imports-- >
<script type = "text/javascript" src ="{portal-address}/static/js/vidizmo-player/player.js" >
</script>
<link rel="stylesheet" href="{portal-address}/static/compiled/widget/widgets.css"/>
<script type="text/javascript" src="{portal-address}/static/compiled/widget/widgets.js ">
</script>
</head>
<body style="margin: 20 px;">
<vdz-mashup-filter show-search-box="true " show-forced-refresh-icon="true " data-widget="true ">
</vdz-mashup-filter>
<vdz-mashup-detailview id="detail-view" data-widget="true" page-size-md="4"
search-criteria={"sortType" : "ASC",
"pageSize" : 36,
"isGlobal" : true,
"showOnChannelLibrary" : true,
"isFeatured" : true
}>
</vdz-mashup-detailview>
<script>
document.getElementById("detail-view").addEventListener("on-mashups-loading", (event) =>
{console.log(event);
console.log("onMashupLoading");
});
document.getElementById("detail-view").addEventListener("on-mashups-loaded", (event) =>
{console.log(event);
console.log("onMashupLoaded")
});
document.getElementById("detail-view").addEventListener("on-mashups-loading-failed", (event) =>
{console.log(event);
console.log("onMashupLoadingFailed")
});
</script>
</body>
</html>
Next Steps
You can playback the content by simply clicking on the content within the Media Library Gallery Widget. Upon clicking the content, an event "onPlay()" would be raised and listened to.
You can learn more about this in the following articles: