Skip to main content

buildfire.mediaPreviewer

The fullscreen media preview allows a developer to instantiate a fullscreen images and videos carousel in app. This is to give a better viewing experience to the end user.

Methods

show()

buildfire.mediaPreviewer.showMedia(options, callback)

Displays a full screen images and videos previewer

buildfire.mediaPreviewer.show(
{
media: [
// video
{
width: 1920,
height: 1080,
videoSrc: 'http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4',
videoPosterSrc: 'https://picsum.photos/1920/1080',
},

// image
{
width: 1080,
height: 1920,
imageSrc: 'https://picsum.photos/1080/1920',
},
],
index: 0,
enableDownload: true,
downloadPermissionRequestButtonText: 'Open settings',
downloadPermissionDeniedMessage: 'Permission denied',
},
(error, result) => {
console.log(
'Media previewer closed'
);
}
);

options

NameTypeRequiredDescriptionDefault
media[object]yesArray of media objects to be displayed in full screen
indexnumbernoIndex of media to start carousel from0
enableDownloadbooleannoEnable download button, allows the user to download the media to device galleryfalse
downloadSuccessMessagestringnoDownload success message to be displayed in a toast messageMedia downloaded successfully
downloadErrorMessagestringnoDownload error message to be displayed in a toast messageFailed to download media
downloadPermissionDeniedMessagestringnoError message to be displayed when save media permission is denied (iOS only)Download to Photos denied
downloadPermissionRequestButtonTextstringnoButton text that navigates to app settings, shown along side downloadPermissionDeniedMessage (iOS only)Settings
info

If the native download feature is not present on device, the download button will not be shown

media

NameTypeRequiredDescriptionDefault
widthnumbernoThe width of the provided media
heightnumbernoThe height of the provided media
videoSrcstringyes if media type is a videoVideo URL to be displayed
imageSrcstringyes if media type is an imageImage URL to be displayed
videoPosterSrcstringno, if the video has a poster imageVideo poster to be displayed before the video is played
info

Video media requires a videoSrc, while image media requires imageSrc

caution

If video media does not have videoPosterSrc it may not show a poster (video image) on iOS or Android. However, a video may accept #t=[start time], example: https://[video source]#t=0.1

callback()

Callback function that gets called when carousel is closed