Media Service
The Media Service provides image, multi-image, and video selector related capabilities.
Methods
openImageSelector(callback)
Description
- Opens an image selector modal allowing the user to select an image, passing it to the callback function
Return Value: null
Options:
callback: FunctionWhen invoked it gets passed the image data which is a url string.
Code Example
digideckCore.mediaService.openImageSelector((imageData) => {
// imageData example: "https://example.com/image-1.png"
});
openMultiImageSelector(callback)
Description
- Opens an image selector modal allowing the user to select multiple images, and returns the assets via the callback argument.
Return Value: null
Options:
callback: Functionwhen invoked it gets passed the imagesData which is an array of the image url strings.
Code Example
digideckCore.mediaService.openMultiImageSelector((imagesData) => {
// imagesData example: ['https://example.com/image-name1.png', 'https://example.com/image-name2.png', 'https://example.com/image-name3.png']
});
openVideoSelector(callback)
Description
- Opens a video selector modal allowing the user to select a video, passing the selected video to the callback function
Return Value: null
Options:
callback: Functionwhen invoked it gets passed the video data.
Code Example
digideckCore.mediaService.openVideoSelector((videoData) => {
// Video Object Structure
{
id: String, // unique video id
title: String, // video title
videoProcessingInfo : { // outlines the current status of the processing video
completed: Boolean,
failed: Boolean,
inProgress: Boolean,
queued: Boolean,
step: String
},
mp4Url: String, // url for the video
previewAnimation: String // url of the animated thumbnail gif for the video
previewImage: String // url of the thumbnail image for the video
}
});
openFileSelector(callback, options)
Description
- Opens the file selector modal allowing the user to select a file, passing the selected file back to the callback function
Return Value: null
Arguments:
callback: Functionwhen invoked it gets passed the selected file data.options: Object// options properties
{
allowedMimeTypes: ['application/pdf'] // an array of strings of the file MIME types that are allowed
}
Code Example
digideckCore.mediaService.openFileSelector((file) => {
// File is an array containing an object with file data
}, {allowedMimeTypes: ['application/pdf', ...moreMimeTypes]});
openAiAssistModal(options)
Description
- Opens the file selector modal, providing the user with the option to choose a file that meets specified criteria.
Return Value: null
Arguments:
options: Object// options properties
{
selectedText: String // This will be the initial text displayed by AI Assist
callback: Function // this will be passed the selected text from AI Assist when invoked
}
Code Example
digideckCore.mediaService.openAiAssistModal({
selectedText: 'Hello World',
callback: selectedText => {
// code block to process the selected text
}
});