{
  "name": "web-amr",
  "version": "0.0.6",
  "description": " AMR Player for the web",
  "main": "dist",
  "files": [
    "dist"
  ],
  "repository": {
    "type": "git",
    "url": "git@github.com:navana-tech/web-amr"
  },
  "keywords": [
    "amr",
    "amr-nb",
    "narrowband",
    "web-audio"
  ],
  "homepage": "https://github.com/navana-tech/web-amr#readme",
  "bugs": {
    "url": "https://github.com/navana-tech/web-amr/issues"
  },
  "author": "Navana Tech (https://navanatech.in)",
  "contributors": [
    "Muthu Kumar <@mkrnavana> (https://mkr.pw)"
  ],
  "license": "MIT",
  "devDependencies": {
    "typescript": "^4.4.3"
  },
  "scripts": {
    "build": "tsc"
  },
  "readme": "# web-amr\n\nAMR audio codec is an audio compression format optimized for speech coding. Since AMR is not a supported web audio format, this library provides an implementation of AMR for use in the web.\n\n> Note: Currently this library only supports narrowband AMR.\n\n## Installation\n\n```sh\n# Using npm\nnpm install web-amr\n\n# Using yarn\nyarn add web-amr\n\n# Using pnpm\npnpm add web-amr\n```\n\n## Usage\n\n```TypeScript\nimport { AMRPlayer } from \"web-amr\";\n\nconst player = AMRPlayer(buffer); // pass file as ArrayBuffer\n```\n\nIf the buffer failed to be decoded, `player.error` will be set. You can check for `player.error?.message` before proceeding.\n\nThe returned `player` instance implements a subset of the [`HTMLMediaElement` API](https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement). Hence, you can use it as a drop-in for a real HTML5 audio player. It might be that this subset of APIs is all that you need from both; in that case, it's safe to do this:\n\n```TypeScript\nimport type { Player } from \"web-amr\";\n\n// assume we have isAMR, audioElement, file,\n// and a function \"read\" that returns ArrayBuffer\n\nif (!isAMR) audioElement.src = file;\nelse audioElement.remove();\n\nconst player: Player = isAMR ? AMRPlayer(read(file)) : audioElement;\n\n// use player normally\n\nplayer.play();\n```\n\n## Available methods\n\n#### `addEventListener`\n\nAppends an event listener for events. The callback argument sets the callback that will be invoked when the event is dispatched.\n\n#### `removeEventListener`\n\nRemoves the event listener in target's event listener list with the same type and callback.\n\n#### `play: (): Promise<void>`\n\nLoads and starts playback of the AMR audio.\n\n#### `pause: (): Promise<void>`\n\nPauses the current playback.\n\n#### `fastSeek: (seconds: number): Promise<void>`\n\nSets the current playback position, in seconds.\n\n## Props\n\n#### `duration: number`\n\nReturns the duration in seconds of the current media resource. A NaN value is returned if duration is not available.\n\n#### `currentTime: number`\n\nGets or sets the current playback position, in seconds.\n\n#### `readonly` `paused: boolean`\n\nGets a flag that specifies whether playback is paused.\n\n#### `readonly` `ended: boolean`\n\nGets information about whether the playback has ended or not.\n\n#### `readonly` `error: MediaError | null`\n\nReturns an object representing the current error state of the audio.\n\n## Contributing\n\nUse `pnpm` as your package manager while installing dependencies. Make sure `pnpm build` runs without an error before raising a PR.\n\n## Acknowledgement\n\nThis project uses an emscripten build of [OpenCORE-AMR](https://sourceforge.net/projects/opencore-amr/) from [yxl](https://github.com/yxl/opencore-amr-js).\n"
}