{"_id":"@kaliber/use-subtitles","_rev":"37-0a014790c287cdb1e61a3437fef62893","name":"@kaliber/use-subtitles","dist-tags":{"latest":"1.0.3-beta"},"versions":{"1.0.0-alpha":{"name":"@kaliber/use-subtitles","version":"1.0.0-alpha","keywords":["WebVTT","use-subtitles"],"license":"MIT","_id":"@kaliber/use-subtitles@1.0.0-alpha","maintainers":[{"name":"melissabos18","email":"mbos@kaliber.net"},{"name":"janbru","email":"jbrunemann@kaliber.net"},{"name":"albertkaliber","email":"asmit@kaliber.net"},{"name":"jerryduijm","email":"jduijm@kaliber.net"},{"name":"hjsielcken","email":"hsielcken@kaliber.net"},{"name":"kaliber-owner","email":"development@kaliber.net"},{"name":"daveykropf","email":"davey@kaliber.net"},{"name":"eecolor","email":"eecolor@gmail.com"},{"name":"pkuepers","email":"pkuepers@kaliber.net"},{"name":"larsvankleef","email":"spamlabtap@gmail.com"}],"dist":{"shasum":"757356db7c2d61b26f74be33cdb8e825cce2a77f","tarball":"https://registry.npmjs.org/@kaliber/use-subtitles/-/use-subtitles-1.0.0-alpha.tgz","fileCount":10,"integrity":"sha512-Re0pYXlV0oHl3EJk9rhyFkF9wFr9o/EO1dLOwoEGI9wqsk0V6IVVGMzXtPQUHKcq9nLKUsYMmu2fYozbVUya9A==","signatures":[{"sig":"MEQCIHzQp9Dk0xFowMQECeIVofl2JfQyn5VC1f2FdTa8GuutAiACaQpD63ujLxqVQWrObDyj44DctpHKL5Q36xoELW+A8Q==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":9496},"main":"src/index.js","private":false,"_npmUser":{"name":"albertkaliber","email":"asmit@kaliber.net"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"https://github.com/kaliberjs/library.git","type":"git"},"description":"A short description","directories":{},"licenseText":"MIT License\n\nCopyright (c) 2021 kaliber.js\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","sideEffects":false,"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/use-subtitles_1.0.0-alpha_1691099467254_0.9559054271294638","host":"s3://npm-registry-packages"}},"1.0.0-beta":{"name":"@kaliber/use-subtitles","version":"1.0.0-beta","keywords":["WebVTT","use-subtitles"],"license":"MIT","_id":"@kaliber/use-subtitles@1.0.0-beta","maintainers":[{"name":"melissabos18","email":"mbos@kaliber.net"},{"name":"janbru","email":"jbrunemann@kaliber.net"},{"name":"albertkaliber","email":"asmit@kaliber.net"},{"name":"jerryduijm","email":"jduijm@kaliber.net"},{"name":"hjsielcken","email":"hsielcken@kaliber.net"},{"name":"kaliber-owner","email":"development@kaliber.net"},{"name":"daveykropf","email":"davey@kaliber.net"},{"name":"eecolor","email":"eecolor@gmail.com"},{"name":"pkuepers","email":"pkuepers@kaliber.net"},{"name":"larsvankleef","email":"spamlabtap@gmail.com"}],"dist":{"shasum":"b2d98b010c055a24111236d20f28a2aec3dba118","tarball":"https://registry.npmjs.org/@kaliber/use-subtitles/-/use-subtitles-1.0.0-beta.tgz","fileCount":12,"integrity":"sha512-vhZMzM5IsHZmtbF/9/Ywa2QEW1LqMZoAV8zzQd1G0zzgmAGufbXpI1k3hriSOsFAYFEhOsmUgPdfmtz9FK4khQ==","signatures":[{"sig":"MEUCIQCsOPG1JBnRESi5glHH9MaKU//Mb4U3OepIayMxa4gyJgIgTuXgJqSJIAngjZblBEacizbRSclsTVSzg9HbU5G8ifY=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":9600},"main":"src/index.js","private":false,"_npmUser":{"name":"albertkaliber","email":"asmit@kaliber.net"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"https://github.com/kaliberjs/library.git","type":"git"},"description":"A short description","directories":{},"licenseText":"MIT License\n\nCopyright (c) 2021 kaliber.js\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","sideEffects":false,"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/use-subtitles_1.0.0-beta_1691480517289_0.9813458021027301","host":"s3://npm-registry-packages"}},"1.0.1-beta":{"name":"@kaliber/use-subtitles","version":"1.0.1-beta","keywords":["WebVTT","use-subtitles"],"license":"MIT","_id":"@kaliber/use-subtitles@1.0.1-beta","maintainers":[{"name":"melissabos18","email":"mbos@kaliber.net"},{"name":"janbru","email":"jbrunemann@kaliber.net"},{"name":"albertkaliber","email":"asmit@kaliber.net"},{"name":"jerryduijm","email":"jduijm@kaliber.net"},{"name":"hjsielcken","email":"hsielcken@kaliber.net"},{"name":"kaliber-owner","email":"development@kaliber.net"},{"name":"daveykropf","email":"davey@kaliber.net"},{"name":"eecolor","email":"eecolor@gmail.com"},{"name":"pkuepers","email":"pkuepers@kaliber.net"},{"name":"larsvankleef","email":"spamlabtap@gmail.com"}],"dist":{"shasum":"db12402d83f6d30fbfb50b7bef4a980de8d3d6d3","tarball":"https://registry.npmjs.org/@kaliber/use-subtitles/-/use-subtitles-1.0.1-beta.tgz","fileCount":12,"integrity":"sha512-nOkQTcHwXB8/KnMLleeJVfd/IGP4kDxkdSnvc+8M24uMyx9zYqY7CYQUTxE8j4UqXGnkAIGc4i9OrVsIugMkhQ==","signatures":[{"sig":"MEUCIQCeGeSOXa276s0P4MrQ2b+yF/drrkcfJb0ToH3X7CRjlQIgTfhUKj+FRLar9fiRFVMOYC/7f8WAua6PqjtCRv5IcNg=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":9643},"main":"src/index.js","private":false,"_npmUser":{"name":"albertkaliber","email":"asmit@kaliber.net"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"https://github.com/kaliberjs/library.git","type":"git"},"description":"Hook to easily consume your HTMLMediaElement WebVTT subtitles.","directories":{},"licenseText":"MIT License\n\nCopyright (c) 2021 kaliber.js\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","sideEffects":false,"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/use-subtitles_1.0.1-beta_1691480993841_0.12673431432529214","host":"s3://npm-registry-packages"}},"1.0.2-beta":{"name":"@kaliber/use-subtitles","version":"1.0.2-beta","keywords":["WebVTT","use-subtitles"],"license":"MIT","_id":"@kaliber/use-subtitles@1.0.2-beta","maintainers":[{"name":"melissabos18","email":"mbos@kaliber.net"},{"name":"janbru","email":"jbrunemann@kaliber.net"},{"name":"albertkaliber","email":"asmit@kaliber.net"},{"name":"jerryduijm","email":"jduijm@kaliber.net"},{"name":"hjsielcken","email":"hsielcken@kaliber.net"},{"name":"kaliber-owner","email":"development@kaliber.net"},{"name":"daveykropf","email":"davey@kaliber.net"},{"name":"eecolor","email":"eecolor@gmail.com"},{"name":"pkuepers","email":"pkuepers@kaliber.net"},{"name":"larsvankleef","email":"spamlabtap@gmail.com"}],"dist":{"shasum":"7bfe2918fa9468cc4299dd8a4fcf765b7bccc266","tarball":"https://registry.npmjs.org/@kaliber/use-subtitles/-/use-subtitles-1.0.2-beta.tgz","fileCount":12,"integrity":"sha512-nsgcTGCryOINtdwjYi6HfCNSsMJLpwdumWI3kfvjnKu+tGS3kQEATKXGlzERI60FKl+X+Coxatv1FO9/+eO+Aw==","signatures":[{"sig":"MEUCIQCNEAGkpHsepQyXjaiQYKDu4tda7cAUfQTp/92dix8LJwIgWDq960+ix4VLhjt9i0r6IheZrQ/1MnAPqH6Y+mK+4JA=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":9899},"main":"src/index.js","private":false,"_npmUser":{"name":"albertkaliber","email":"asmit@kaliber.net"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"https://github.com/kaliberjs/library.git","type":"git"},"description":"Hook to easily consume your HTMLMediaElement WebVTT subtitles.","directories":{},"licenseText":"MIT License\n\nCopyright (c) 2021 kaliber.js\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","sideEffects":false,"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/use-subtitles_1.0.2-beta_1691497913715_0.032945880462084576","host":"s3://npm-registry-packages"}},"1.0.3-beta":{"name":"@kaliber/use-subtitles","version":"1.0.3-beta","keywords":["WebVTT","use-subtitles"],"license":"MIT","_id":"@kaliber/use-subtitles@1.0.3-beta","maintainers":[{"name":"melissabos18","email":"mbos@kaliber.net"},{"name":"janbru","email":"jbrunemann@kaliber.net"},{"name":"albertkaliber","email":"asmit@kaliber.net"},{"name":"jerryduijm","email":"jduijm@kaliber.net"},{"name":"hjsielcken","email":"hsielcken@kaliber.net"},{"name":"kaliber-owner","email":"development@kaliber.net"},{"name":"daveykropf","email":"davey@kaliber.net"},{"name":"eecolor","email":"eecolor@gmail.com"},{"name":"pkuepers","email":"pkuepers@kaliber.net"},{"name":"larsvankleef","email":"spamlabtap@gmail.com"}],"dist":{"shasum":"bf6ee9b90e491a39d1bfb7eb86957a9d94280fb8","tarball":"https://registry.npmjs.org/@kaliber/use-subtitles/-/use-subtitles-1.0.3-beta.tgz","fileCount":12,"integrity":"sha512-75GKqfVE/CSmv55cXFoHU3KzJpyi0HkCRJHdSmcXY2CUkgI4IPvh+q8JIDslvHhYu3MZ6IA0Azj9OHXpRZn/Bw==","signatures":[{"sig":"MEQCIGkvRBzfQfBAEn6MyILS7dCX8RFe570hEo8lhZdHTlgRAiB+F03qMg3gZnKfR+gLhTVf+CHB9W6K1fzjPdpmiAnW2g==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":11667},"main":"src/index.js","private":false,"_npmUser":{"name":"albertkaliber","email":"asmit@kaliber.net"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"https://github.com/kaliberjs/library.git","type":"git"},"description":"Hook to easily consume your HTMLMediaElement WebVTT subtitles.","directories":{},"licenseText":"MIT License\n\nCopyright (c) 2021 kaliber.js\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","sideEffects":false,"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/use-subtitles_1.0.3-beta_1698238933923_0.9133345096036523","host":"s3://npm-registry-packages"}}},"time":{"created":"2023-08-03T21:51:07.131Z","modified":"2026-09-09T12:43:29.300Z","1.0.0-alpha":"2023-08-03T21:51:07.441Z","1.0.0-beta":"2023-08-08T07:41:57.443Z","1.0.1-beta":"2023-08-08T07:49:54.046Z","1.0.2-beta":"2023-08-08T12:31:53.865Z","1.0.3-beta":"2023-10-25T13:02:14.355Z"},"license":"MIT","keywords":["WebVTT","use-subtitles"],"repository":{"url":"https://github.com/kaliberjs/library.git","type":"git"},"description":"Hook to easily consume your HTMLMediaElement WebVTT subtitles.","maintainers":[{"email":"davey@kaliber.net","name":"daveykropf"},{"email":"ewestra@kaliber.net","name":"eecolor"},{"email":"jduijm@kaliber.net","name":"jerryduijm"},{"email":"development@kaliber.net","name":"kaliber-owner"},{"email":"nhoenderop@kaliber.net","name":"nhoenderop"},{"email":"jbrunemann@kaliber.net","name":"janbru"},{"email":"asmit@kaliber.net","name":"albertkaliber"},{"email":"mvanbrakel@kaliber.net","name":"mvanbrakel"},{"email":"Rvanschaik@kaliber.net","name":"r0h-oh"},{"email":"claan@kaliber.net","name":"1cln"},{"email":"mreimus@kaliber.net","name":"maart-22"},{"email":"ldavidsondescelles@kaliber.net","name":"yoreljenkins"},{"email":"mdevalk@kaliber.net","name":"mdevalk1983"},{"email":"guido.evertzen@gmail.com","name":"guido.evertzen"},{"email":"svroom@kaliber.net","name":"svroom-kaliber"},{"email":"tomharms93@proton.me","name":"tomharms"},{"email":"rinus.vh@hotmail.com","name":"rinus.vh"},{"email":"pgoddijn@gmail.com","name":"pgoddijn"},{"email":"jvankralingen@kaliber.net","name":"jvankralingen"}],"readme":"# `@kaliber/use-subtitles`\nEasily consume your video elements' WebVTT subtitles in React.\n\n## Motivation\nWebVTT subtitles are a great feature, but they come with some difficulties:\n- Styling the subtitles with CSS to achieve a consistent look across browsers can be challenging.\n- Third party dependencies hide the underlaying `HTMLMediaElement`, and thus;\n- Interfacing with the subtitles from JavaScript code is not straightforward.\n\n**This hook aims to make that easier for you.**\n\n## Installation\n\n```\nyarn add @kaliber/use-subtitles\n```\n\n#### Transpilation\n\nWhen working with `@kaliber/build`, add `@kaliber/use-subtitles` to your `compileWithBabel` array. \n\n## Usage\nHere's a short example demonstrating the most common use case.\n\n\n```jsx\nimport { useSubtitles } from '@kaliber/use-subtitles'\n\nfunction Component() {\n  const { ref } = useSubtitles({\n    language: \"en\"\n  })\n\n  return (\n    <video {... { ref }}>\n      <source type=\"audio/mp3\" src=\"./audio.mp3\" />\n      <track src=\"./subtitle.vtt\" kind=\"subtitles\" srcLang=\"en\" default />\n    </video>\n  )\n}\n```\n\nLook at the [`/example`](/example) directory for further examples.\n\n## Usage with `ReactPlayer`\nAs long as you are able provide the underlying `HTMLMediaElement` of your dependency, the library should work.\n\nBecause `ReactPlayer` only provides the underlaying ref whenever it deems it ready, we need to set it through the `onReady` method (up until that time, its value will otherwise be `null`).\n\n```jsx\nimport { useSubtitles } from '@kaliber/use-subtitles'\nimport ReactPlayer from 'react-player'\n\nconst config = {\n  file: { tracks: [{\n    kind: \"subtitles\",\n    src: \"/subtitle.vtt\",\n    srcLang: \"en\",\n    default: true\n  }]}\n}\n\nfunction Component() {\n  const reactPlayerRef = React.useRef(null)\n  const { current, ref } = useSubtitles({\n    language: \"en\"\n  })\n\n  return (\n    <ReactPlayer\n      ref={reactPlayerRef}\n      onReady={x => { ref.current = x.getInternalPlayer() }}\n      url=\"./audio.mp3\"\n      {... { config }}\n    />\n  )\n}\n```\n\n## Parameters\nThe hook accepts the following parameters:\n\n| Key          | Type          | Example | Description   |\n| ------------- | ------------- | ------------- | --- |\n| `language`  | `string`  | `nl` | Expects a language code that matches the `track` language. Bear in mind this has to be a [ISO 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) string. For example in case of Japan, `jp` does not work in all browsers, where `ja` does, which is the valid ISO code.  |\n\n## Return values\nThe `useSubtitles` hook returns the following values:\n\n| Key            | Initial values | Description                                                                                                    |\n|-----------------| --- |---------------------------------------------------------------------------------------------------------------|\n| `subtitles`     | `[]` | An array of all subtitles available for the specified language.                                              |\n| `metadata`     | `[]` | An array of all metadata available for the specified language.                                              |\n| `active`       | See below. | An object representing the currently active subtitle and metadata, with metadata containing the properties `startTime`, `endTime`, and `text`, and subtitle also containing `voice`[^1]. |\n| `ref`           | `{ current: null }` | A reference that should be attached to the player element ref attribute.                                    |\n\n#### The structure of the `active` object:\n\n```js\n{\n  subtitles: {\n    [key]: null\n  },\n  metadata: {\n    [key]: null\n  }\n}\n```\n\n[^1]: `voice` represents the current speakers' name.\n\n\n## WebVTT\nA WebVTT file typically looks like this: \n\n```vtt\nWEBVTT\n\n00:00:00.000 --> 00:00:20.000\n<v Fred>Hi, my name is Fred\n\n00:00:02.500 --> 00:00:22.500\n<v Bill>Hi, I’m Bill\n\n00:00:05.000 --> 00:00:25.000\n<v Fred>Would you like to get a coffee?\n\n00:00:07.500 --> 00:00:27.500\n<v Bill>Sure! I’ve only had one today.\n\n00:00:10.000 --> 00:00:30.000\n<v Fred>This is my fourth!\n\n00:00:12.500 --> 00:00:32.500\n<v Fred>OK, let’s go.\n```\n\n## Metadata\n\nThis hook also has the option to extract metadata; additional data to support the subtitles, but are not directly shown to the user. This accepts JSON (which it parses and returns), or a regular string.\n\nExample of a WebVTT metadata file (with `JSON`):\n\n```vtt\nWEBVTT\n\n00:00:00.000 --> 00:00:01.000\n{ \"text\": \"Living on borrowed time\", \"color\": \"red\" }\n\n00:00:01.000 --> 00:00:02.400\n{ \"text\": \"the clock ticks faster.\", \"color\": \"red\" }\n```\n\nLook at the `Karaoke` example for an implementation.\n\n#### Extracted properties\n`use-subtitles` extracts some of the available data from the cues. Here's an overview of _what_ it extracts, and how that is returned.\n\n| Kind | Description |\n| ---- | ----------- |\n| `00:00:00.000 --> 00:00:20.000` | Timestamp. Outputted under `current.startTime` and `currrent.endTime`, and available for all cues in the `subtitles` array. |\n| `<v Fred>` | `voice`-tag. Outputted by hook under `current.voice`. |\n| `Hi, my name is Fred` | The `text`, available under `current.text`, and available for all cues in the `subtitles` array as `text`. |\n\n---\n\n![](https://media.giphy.com/media/kKJ8YFi1VVhHFudiz2/giphy.gif)\n\n## Disclaimer\nThis library is intended for internal use, we provide __no__ support, use at your own risk. It does not import React, but expects it to be provided, which [@kaliber/build](https://kaliberjs.github.io/build/) can handle for you.\n\nThis library is not transpiled.\n","readmeFilename":"readme.md"}