1.0.0 • Published 3 years ago
js-dadan-sdk v1.0.0
Dadan Sdk CDN
A lightweight JavaScript sample shows how to use Google Dadan Extension for checking, validating, and manipulating videos
How It Works ?
we add the following scripts into index.html web page
<script src="https://resources-dadan-io.s3.eu-central-1.amazonaws.com/sdk/dadan-extension-core.js"></script>
<scrip src="https://resources-dadan-io.s3.eu-central-1.amazonaws.com/sdk/dadan-extension-cdn.js"></script>
Usage
In your html page we include the follwing
<div id="record-video-button"></div>
<!--the div container which holds the button-->
<input type="text" id="return-control-id" />
<!--the input text which will holds sharedUrl-->
In script tag we include the following
const recordVideoButton = new RecordVideoButton(
{
containerId: "record-video-button",
title: "Select Video",
type: "select",
buttonClass: "dd__record__button__default__class",
buttonStyle: "",
showSvg: true,
showPreview: true,
copyToClipboard: true,
returnControlId: "return-control-id",
},
handleResponse, // handle success
handleResponse // handle failure
);
the handleResponse function , is a callback function which accept object with three parameters
function handleResponse({ success, data, message }) {
if (success) {
// only false when user close extension
if (data) {
// represnts the selected videos , or recorded video object after stop recording
console.table(data);
}
} else {
console.error(message); //User Closed Extension
}
}
Record Button Object Options
Parameter | Type | Description |
---|---|---|
containerId | string | Required. the container id that holds the button |
title | string | Required. button title |
type | string | Required. either record or select , else will show error |
buttonClass | string | Optional. the default class , or your custom class |
buttonStyle | string | Optional. the default style , or your custom style as string |
showSvg | boolean | Optional. to show Svg icon in button |
showPreview | boolean | Optional. to show preview dialog of recorded video |
copyToClipboard | boolean | Optional. to notify user that video shared url was copied to clipboard as toast message |
returnControlId | string | Optional. the input text id which will holds sharedUrl of recorded video |
License
1.0.0
3 years ago