0.3.13 • Published 4 years ago

@kcod/render-media-file v0.3.13

Weekly downloads
15
License
MIT
Repository
github
Last release
4 years ago

Notice

There are trouble in making a bundling on Webpack with React Hooks. So I change this as a class component. Next time I will try to insert rich control options such as tag colors and React-player controls.

Supporting File Types

pdf, mp4, mp3, jpg, jpeg, gif, png

Installation

React components is available as an npm package.

$ npm i @kcod/render-media-file

⌨️ Usage

Here is a quick example to get you started, it's all you need:

import React from 'react';
import ReactDOM from 'react-dom';
import * as serviceWorker from './serviceWorker';
import RenderMedia from '@kcod/render-media-file';

class App extends React.Component { 
  render() {
    return (
      <RenderMedia 
        fileInfo={{
          src:"https://user-images.com/sample.gif", 
          fileType:"image/gif"}} />
          // if you want to test pdf file, you can see CORS policy. So install Chrome extention program such 'Allow CORS'
          //src:"http://www.orimi.com/pdf-test.pdf",
          //src:"https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf", 
          //fileType:"application/pdf"}} />
    )
  }
}

ReactDOM.render(<App />, document.getElementById('root'));

Demo result

ezgif com-gif-maker

User Guide

Props

Prop nameDescriptionDefault ValueExample Values
fileInfoonly props on this component and this has two atrributes, one is 'src' and the other is 'fileType'. src is the remote location addresses. fileType is MIME typen/afileInfo={{ src:"http://example.com/sample.jpg", fileType:"image/png"}}
0.3.13

4 years ago

0.3.12

4 years ago

0.3.10

4 years ago

0.3.10-0

4 years ago

0.3.9

4 years ago

0.3.8

4 years ago

0.3.7

4 years ago

0.3.6

4 years ago

0.3.5

4 years ago

0.3.4

4 years ago

0.3.3

4 years ago

0.3.2

4 years ago

0.3.2-0

4 years ago

0.3.1

4 years ago

0.3.0

4 years ago