Socket
Socket
Sign inDemoInstall

@samvera/iiif-react-media-player

Package Overview
Dependencies
72
Maintainers
3
Versions
17
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @samvera/iiif-react-media-player

iiif-react-media-player React component for rendering a media player for a IIIF 3.0 spec manifest


Version published
Weekly downloads
26
increased by420%
Maintainers
3
Created
Weekly downloads
 

Changelog

Source

1.2.1 (12/23/2021)

  • 1.2.1
  • Build files for v1.2.1
  • Fix dependencies
  • Code cleanup (#112)
  • Add txt/vtt mime-type to parser
  • Change parser to use http response info to distinguish file types (#111)
  • Fix CSS for word document view
  • Use mammoth to parse .doc to html, remove GDrive viewer (#106)
  • Fix WebVTT parser (#105)
  • URL validation regex change
  • Change feedback for invalid transcript files (#102)
  • Add poster image for video player (#100)
  • Remove time tooltip over playhead (#99)

Readme

Source

@samvera/iiif-react-media-player

Interactive, IIIF powered audio/video media player React components.

General Usage:

Add the @samvera/iiif-react-media-player components library from NPM into your ReactJS application via yarn or npm.

yarn add @samvera/iiif-react-media-player

// Add peer dependencies
yarn add video.js
yarn add videojs-hotkeys

Example usage

import React from 'react';
import { IIIFPlayer, MediaPlayer, StructuredNavigation, Transcript } from "@samvera/iiif-react-media-player";
import 'video.js/dist/video-js.css';

// Import starter styles (in the future this will be optional)
import "@samvera/iiif-react-media-player/dist/iiif-react-media-player.css";

const App = () => {
  // Get your manifest from somewhere
  const manifestUrl = "https://some-manifest-url-here.json";

  // Transcript props
  const props = {
    playerID: 'player-id',
    transcripts: [
      {
        canvasId: 0,
        items: [ { title: "Title", url: "https://some-transcript-url-here.json" } ]
      }
    ]
  }

  return (
    <IIIFPlayer manifestUrl={manifestUrl}>
      <MediaPlayer />
      <StructuredNavigation />
      <Transcript {...props} />
    </IIIFPlayer>
  );
}

export default App;

More detailed explanation and usage of these components, please refer to the Wiki documentation.

Cross-site Requests

** This info pulled from the Diva.js package**

You may receive an error that looks something like this:

XMLHttpRequest cannot load http://example.com/demo/imagefiles.json. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8000' is therefore not allowed access.

This is a security precaution that all browsers use to prevent cross-site request forgeries. If you receive this message it is because your manifestUrl prop and the server used to serve the OpenSeadragon React Viewer are not at the same server address.

To fix this you must ensure that the OpenSeadragon React Viewer host's React application, and the location pointed to by the manifestUrl prop are being served by the same server, or you must create an exception using the Access-Control-Allow-Origin header on your server to explicitly white-list the manifestUrl location.

IIIF 3.0 spec

http://iiif.io/api/presentation/3.0/

Developing

Styleguidist development

Styleguidist, in addition to providing documentation, also offers an isolated development environment. To start the dev environment, run:

yarn dev

To build a static html version of the docs (which Github pages uses), run:

yarn styleguide:build

This will output static documentation HTML files to the project's /styleguide directory.

Deployment

To deploy your forked version of this repo, run:

yarn build

This will create CommoneJS, ES Module, and UMD distribution files located in the /dist/ directory.

Documentation

See the Styleguidist docs for documentation on the components. And our GitHub Wiki for more details on usage and implementation of these components.

Running the tests

To run the tests, with a full coverage report:

yarn test

To run tests in watch mode:

yarn test:watch

Jest is our testing framework, and we're in the process of incorporating react-testing-library https://github.com/testing-library/react-testing-library.

Coding style tests

There is a prettierrc file with project coding style settings.

Built With

  • React - JavaScript component library
  • Jest - Testing framework

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

Authors

See also the list of contributors who participated in this project.

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Acknowledgments

Keywords

FAQs

Last updated on 23 Dec 2021

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc