Giter Site home page Giter Site logo

react-timeline's Introduction

react-subtitle-editor

A React component for adjust subtitles and synchronize easier

Install

npm i react-subtitle-editor

Try it

Demo

Usage

import  React  from  "react";
import  Timeline  from  "react-subtitle-editor";
  
function  App() {
const  mediaRef = useRef(); //access audio/video element.
const  data = [{ begin:  25, end:  35, text:  "This is subtitle" }];
  
return (
<div>
<button  onClick={() =>  audioRef.current.play()}>play</button>
<button  onClick={() =>  audioRef.current.pause()}>pause</button>
  
<Timelines
changeAreaShow={(start, end) => {}}
changeZoomLevel={(zoomLevel) => {}}
changeShift={(shift) => {}}
setAligns={(alignments) => {}}
audioRef={mediaRef}
src={"..."}
data={data}
autoScroll
colors={{
background:  "transparent",
box:  "#a9a9a9",
boxHover:  "#80add6",
selectedBox:  "#1890ff",
playingBox:  "#f0523f",
text:  "#212b33",
selectedText:  "white",
tooltipBackground:  "#474e54",
tooltipText:  "white",
scrollBarBackground:  "#f1f3f9",
scrollBar:  "#c2c9d6",
scrollBarHover:  "#8f96a3",
}}
/>
</div>
);
}

Props

Prop Type Description
paddingLeft Number padding left.
paddingRight Number padding right.
data [{ begin: Number, end: Number, text: String }] Alignments data (begin and end unit is second).
src String Video or audio source.
audioRef React.RefObject Video or audio ref.
changeAreaShow Function Callback when viewport changed.
changeZoomLevel Function Callback when zoom level changed.
changeShift Function Callback when shift changed.
setAligns Function Callback when data times changed.
colors Object Colors object (see example).

Others props will be ready soon.

Contributing

coming soon

react-timeline's People

Contributors

alirezatav avatar mzsm avatar alireza-tav avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.