npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-native-transcript-karaoke

v3.0.0

Published

Karaoke-style transcript manipulation for react native

Downloads

88

Readme

React Native Transcript Karaoke

Super simple karaoke-style transcript manipulation for react native.

Installation

npm install react-native-transcript-karaoke

Usage

N.B.: This component works really well out-of-the-box with react-native-track-player.

As the passed in progress advances, the component will progressively re-style the chunks of text based on their timestamps, applying the styles passed in via activeStyles.

The progress property can either represent seconds or milliseconds. All you need to do is tell the component which of the two (via progressType) you wish to use and let it handle the rest.

If you wish to add interactivity to your Karaoke (Similar to Spotify), then you can use the onSeekTo prop which exposes onPress events from individual chunks.

By default, a "chunk" is defined per new-line, a timestamp is in the format of [HH:mm:ss] or [HH:mm:ss.SSS] and we expect the current progress to be specified in seconds.

🚨 Please note that at this point in time, we do not support custom timestamp identifiers beyond HH:mm:ss or HH:mm:ss.SSS out-of-the-box. You can implement your own transcript parser by extending the abstract Parser class and providing your own implementation via the parser prop to give yourself more flexability. The abstract Parser class has a few utility functions to make your life easier if you do decide to do this.

const transcript = `
  [00:00:03] Tell me something I need to know
  [00:00:07] Then take my breath and never let it go
  [00:00:12] If you just let me invade your space
  [00:00:17] I'll take the pleasure, take it with the pain
  [00:00:22] And if in the moment, I bite my lip
  [00:00:27] Baby, in that moment, you'll know this is
  [00:00:32] Something bigger than us and beyond bliss
  [00:00:37] Give me a reason to believe it
`

<Karaoke
  transcript={transcript}
  progress={progress}
  progressType='seconds'
  activeStyle={{color: 'red'}}
/>

For a richer example, see the /example directory in our repository.

API

interface KaraokeProps {
  /**
   * The transcript we wish to provide karaoke styling for
   */
  transcript: string
  /**
   * The current progress of the audio track being played
   */
  progress: number
  /**
   * The format that the current progress is given in
   */
  progressType?: ProgressType
  /**
   * The base style we wish to apply to the displayed transcript
   */
  style?: StyleProp<TextStyle>
  /**
   * The style we wish to apply to previous and current chunks of
   * the transcript
   */
  activeStyle?: StyleProp<TextStyle>
  /**
   * The parser we wish to use to parse the transcript
   */
  parser?: Parser
  /**
   * Exposes `onPress` events from chunks
   *
   * @param seekTo The duration the user has indicated they want to seek to
   */
  onSeekTo?: (seekTo: number) => void
}