React Transcript Editor
A React component to make transcribing audio and video easier and faster.
The project uses this github project boards to organise and the co-ordinate development.
--> Work in progress <--
- You can see a demo by clicking here (and then click the
- And you can see a list of features here.
- npm >
- Node 10 - dubnium
Node version is set in node version manager
Fork this repository + git clone + cd into folder
Usage - development
Git clone this repository and cd into the folder.
To start the storybook run
Usage - production
Available on npm -
npm install @bbc/react-transcript-editor
Minimal data needed for initialization
With more attributes
|mediaUrl||string url to media file - audio or video||yes||String|
||returns content of transcription after a change||no||Function|
|autoSaveContentType||specify the file format for data returned by
|isEditable||set to true if you want to be able to edit the text||no||Boolean|
|spellCheck||set to true if you want the browser to spell check this transcript||no||Boolean|
||if you want to collect analytics events.||no||Function|
|fileName||used for saving and retrieving local storage blob files||no||String|
|title||defaults to empty string||no||String|
|ref||if you want to have access to internal functions such as retrieving content from the editor. eg to save to a server/db.||no||React ref|
|timecodeOffset||a number (in seconds) to offset transcript timecodes, eg. to synchronise timings from the camera||no||Number|
./demo/app.js demo as a more detailed example usage of the component.
fileName it is optional but it's needed if working with user uploaded local media in the browser, to be able to save and retrieve from local storage. For instance if you are passing a blob url to
createObjectURL this url is randomly re-generated on every page refresh so you wouldn't be able to restore a session, as
mediaUrl is used as the local storage key. See demo app for more detail example of this
mediaType if not defined, the component uses the url to determine the type and adjust the layout accordingly, however this could result in a slight delay when loading the component as it needs to fetch the media to determine it's file type
If using in a parent project where typescript is being used you might need to add
//@ts-ignore before the import statment like this
You can also import some of the underlying React components directly.
To import the components you can do as follows
However if you are not using
TranscriptEditor it is recommended to follow the second option and import individual components like:
@bbc/react-transcript-editor/TimedTextEditor rather than the entire library. Doing so pulls in only the specific components that you use, which can significantly reduce the amount of code you end up sending to the client. (Similarly to how
See the storybook for each component details on optional and required attributes.
You can also use this node modules as standalone
Converts from draftJs json format to other formats
Converts various stt json formats to draftJs
some modules to convert to and from timecodes
storybookwith the setup as explained in their docs to develop this React.
- This uses CSS Modules to contain the scope of the css for this component.
- `.storybook/webpack.config.js enanches the storybook webpack config to add support for css modules.
- The parts of the component are inside
- babel.config.js provides root level system config for babel 7.
There's a docs folder in this repository.
docs/notes contains dev notes on various aspects of the project.
An architectural decision record (ADR) is a document that captures an important architectural decision made along with its context and consequences.
We are using this template for ADR
There also QA testing docs to manual test the component before a major release, (QA testing does not require any technical knowledge).
./packagesand create a build in the
npm run build:component
Demo & storybook
Storybook can bew viewed at https://bbc.github.io/react-transcript-editor/
Demo can be viewed at https://bbc.github.io/react-transcript-editor/iframe.html?id=demo--default
Build - storybook
To build the storybook as a static site
npm run build:storybook
Publish storybook & demo to github pages
This github repository uses github pages to host the storybook and the demo of the component
npm run deploy:ghpages
add to git, and push to origin master to update
Alternatively If you simply want to build the demo locally in the
build folder then just
npm run build:storybook
you can then run this command to serve the static site locally
npm run build:storybook:serve
Test coverage using
jest, to run tests
npm run test
During development you can use
npm run test:watch
To push to npm -
npm run build:component and
npm publish --access public under the hood
Note that only
distfolders are published to npm.
Despite using React and DraftJs, the BBC is not promoting any Facebook products or other commercial interest.