3.0.15 • Published 12 months ago

react-image-video-viewer v3.0.15

Weekly downloads
-
License
MIT
Repository
github
Last release
12 months ago

React image & video viewer

View demo

Installation

npm install react-image-video-viewer

Usage

<ReactImageVideoviewer
  data={[
    {
      url: "https://placekitten.com/450/300",
      type: "photo",
      altTag: "some image",
    },
    {
      url: "https://www.youtube.com/embed/ScMzIvxBSi4",
      type: "video",
      title: "some video",
    },
    {
      url: "https://file-examples.com/storage/fea9880a616463cab9f1575/2017/04/file_example_MP4_480_1_5MG.mp4",
      type: "video",
      poster: "posterImg.jpg",
    },
    {
      url: "https://www.youtube.com/embed/ScMzIvxBSi4",
      type: "video",
      title: "some other video",
    },
  ]}
  startIndex={0}
  showResourceCount={true}
  onCloseCallback={this.callbackFunction}
  onNavigationCallback={(currentIndex) =>
    console.log(`Current index: ${currentIndex}`)
  }
/>

Properties

PropertyTypeDescription
dataArray of resourcesAn array of resource objects (see resource object below)
startIndexnumberIndex of image/video where the viewer should open
showResourceCountbooleanShow resource count in the upper left corner
onCloseCallbackFunction => voidCallback function called when the viewer is closed
onNavigationCallbackFunction(currentIndex) => voidCallback function called on navigation between resources

Resource Object

PropertyTypeDescription
urlstringUrl of the image/video
typestringTwo types are supported - 'photo' & 'video' (only .mp4, .mov and YouTube videos are supported)
altTagstringAlt tag for image
titlestringTitle for iframe when rendering YouTube, .mp4 or .mov video
posterstringPoster image for .mp4 or .mov video
autoPlaybooleanAutoplay video for .mp4 or .mov video
3.0.12

12 months ago

3.0.13

12 months ago

3.0.10

12 months ago

3.0.11

12 months ago

3.0.8

12 months ago

3.0.7

12 months ago

3.0.14

12 months ago

3.0.15

12 months ago

3.0.9

12 months ago

3.0.6

12 months ago

3.0.5

12 months ago

3.0.4

12 months ago

3.0.3

12 months ago

3.0.2

12 months ago

3.0.1

12 months ago