Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
SupertigerDev committed Jan 3, 2024
1 parent 2fbcf0d commit a14af97
Show file tree
Hide file tree
Showing 9 changed files with 1,135 additions and 781 deletions.
5 changes: 5 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"cSpell.words": [
"dataavailable"
]
}
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2022 {{me}}
Copyright (c) 2022 Nerimity

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
56 changes: 41 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,36 +1,62 @@
<p>
<img width="100%" src="https://assets.solidjs.com/banner?type={{name_of_lib}}&background=tiles&project=%20" alt="{{name_of_lib}}">
<img width="100%" src="https://assets.solidjs.com/banner?type=@nerimity/solid-opus-media-recorder&background=tiles&project=%20" alt="@nerimity/solid-opus-media-recorder">
</p>

# {{name_of_lib}}
# @nerimity/solid-opus-media-recorder

[![pnpm](https://img.shields.io/badge/maintained%20with-pnpm-cc00ff.svg?style=for-the-badge&logo=pnpm)](https://pnpm.io/)

{{desc_of_lib}}
Opus ogg mic recorder to blob

> **Note** After using this template, you have to search and replace all `{{name_of_lib}}` and similar strings
> with appropriate texts.
>
> `{{name_of_lib}}` should be a **kebab-case** string representing the name of you monorepo.
>
> `{{desc_of_lib}}` should be a **Normal case** string with the description of the repository.
>
> `{{me}}` should be a **kebab-case** string from your profile URL.

## Quick start

Install it:

```bash
npm i {{name_of_lib}}
npm i @nerimity/solid-opus-media-recorder
# or
yarn add {{name_of_lib}}
yarn add @nerimity/solid-opus-media-recorder
# or
pnpm add {{name_of_lib}}
pnpm add @nerimity/solid-opus-media-recorder
```


# Important
Before using this library, make sure to create a seperate `init.ts` file and import it from your main/index.ts.
```js
// init.ts
window.global ||= window;

// index/main.ts
import './init';

```



Use it:

```tsx
import {{name_of_lib}} from '{{name_of_lib}}'
import { useMicRecorder } from '@nerimity/solid-opus-media-recorder'

const App = () => {
const {record, stop} = useMicRecorder();

const onRecordClick = async () => {
console.log("recording...")
const blob = await record();
console.log("recorded", blob)
}

return (
<div>
<button onClick={onRecordClick}>Record</button>
<button onClick={stop}>Stop</button>
</div>
)
}

export default App

```
33 changes: 12 additions & 21 deletions dev/App.tsx
Original file line number Diff line number Diff line change
@@ -1,28 +1,19 @@
import type { Component } from 'solid-js'
import logo from './logo.svg'
import styles from './App.module.css'
import { Hello } from '../src'
import { useMicRecorder } from '../src'

const App = () => {
const {record, stop} = useMicRecorder();

const onRecordClick = async () => {
console.log("recording...")
const blob = await record();
console.log("recorded", blob)
}

const App: Component = () => {
return (
<div class={styles.App}>
<header class={styles.header}>
<img src={logo} class={styles.logo} alt="logo" />
<h1>
<Hello></Hello>
</h1>
<p>
Edit <code>src/App.tsx</code> and save to reload.
</p>
<a
class={styles.link}
href="https://github.com/solidjs/solid"
target="_blank"
rel="noopener noreferrer"
>
Learn Solid
</a>
</header>
<button onClick={onRecordClick}>Record</button>
<button onClick={stop}>Stop</button>
</div>
)
}
Expand Down
14 changes: 14 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
declare module 'opus-media-recorder' {

declare class OpusMediaRecorder extends MediaRecorder {
constructor(stream: MediaStream, options?: MediaRecorderOptions, workerOptions?: OpusMediaRecorderWorkerOptions)
}

export interface OpusMediaRecorderWorkerOptions {
encoderWorkerFactory: () => Worker,
OggOpusEncoderWasmPath: string,
WebMOpusEncoderWasmPath: string,
}

export = OpusMediaRecorder
}
47 changes: 25 additions & 22 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
{
"name": "{{name_of_lib}}",
"version": "0.0.0",
"description": "{{desc_of_lib}}",
"name": "@nerimity/solid-opus-media-recorder",
"version": "1.0.1",
"description": "Opus ogg mic recorder to blob",
"license": "MIT",
"author": "{{me}}",
"author": "Nerimity",
"contributors": [],
"repository": {
"type": "git",
"url": "git+https://github.com/{{me}}/{{name_of_lib}}.git"
"url": "git+https://github.com/Nerimity/@nerimity/solid-opus-media-recorder.git"
},
"homepage": "https://github.com/{{me}}/{{name_of_lib}}#readme",
"homepage": "https://github.com/Nerimity/@nerimity/solid-opus-media-recorder#readme",
"bugs": {
"url": "https://github.com/{{me}}/{{name_of_lib}}/issues"
"url": "https://github.com/Nerimity/@nerimity/solid-opus-media-recorder/issues"
},
"files": [
"dist"
],
"private": false,
"sideEffects": false,
"sideEffects": true,
"type": "module",
"main": "./dist/index.js",
"module": "./dist/index.js",
Expand Down Expand Up @@ -57,23 +57,23 @@
"solid-js": "^1.6.0"
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^6.1.0",
"@typescript-eslint/parser": "^6.1.0",
"concurrently": "^8.2.0",
"esbuild": "^0.18.15",
"@typescript-eslint/eslint-plugin": "^6.17.0",
"@typescript-eslint/parser": "^6.17.0",
"concurrently": "^8.2.2",
"esbuild": "^0.19.11",
"esbuild-plugin-solid": "^0.5.0",
"eslint": "^8.45.0",
"eslint": "^8.56.0",
"eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-no-only-tests": "^3.1.0",
"jsdom": "^22.1.0",
"prettier": "3.0.0",
"solid-js": "^1.7.8",
"tsup": "^7.1.0",
"tsup-preset-solid": "^2.0.1",
"typescript": "^5.1.6",
"vite": "^4.4.6",
"vite-plugin-solid": "^2.7.0",
"vitest": "^0.33.0"
"jsdom": "^23.0.1",
"prettier": "3.1.1",
"solid-js": "^1.8.7",
"tsup": "^8.0.1",
"tsup-preset-solid": "^2.2.0",
"typescript": "^5.3.3",
"vite": "^5.0.10",
"vite-plugin-solid": "^2.8.0",
"vitest": "^1.1.1"
},
"keywords": [
"solid"
Expand All @@ -82,5 +82,8 @@
"engines": {
"node": ">=18",
"pnpm": ">=8.6.0"
},
"dependencies": {
"opus-media-recorder": "^0.8.0"
}
}
Loading

0 comments on commit a14af97

Please sign in to comment.