javascript - Create "Karaoke" Type Functionality in DraftJS -
i attempting implement draftjs editor highlights words in transcription while recorded audio playing (kind of karaoke).
i receive data in format:
[ { transcript: "this first block", timestamps: [0, 1, 2.5, 3.2, 4.1, 5], }, { transcript: "this second block. let's sync audio words", timestamps: [6, 7, 8.2, 9, 10, 11.3, 12, 13, 14, 15, 16, 17.2], }, ... ] i map received data contentblocks , initialize editor's contentstate them using contentstate.createfromblockarray(blocks)
it seems "draftjs" way of storing timestamp metadata create entity each word respective timestamp, , scan through currentcontent audio plays , highlight entities until current elapsed time. not sure if right way this, doesn't seem performant large transcriptions.
note: transcript needs remain editable while maintaining karaoke functionality
any or discussion appreciated!
Comments
Post a Comment