mediasfu-shared 1.0.3 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +108 -103
- package/package.json +99 -96
package/README.md
CHANGED
|
@@ -1,103 +1,108 @@
|
|
|
1
|
-
# mediasfu-shared
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
-
|
|
10
|
-
|
|
11
|
-
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
- `mediasfu-shared
|
|
76
|
-
- `mediasfu-shared/
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
-
|
|
100
|
-
|
|
101
|
-
##
|
|
102
|
-
|
|
103
|
-
|
|
1
|
+
# mediasfu-shared · [mediasfu-shared on npm](https://www.npmjs.com/package/mediasfu-shared)
|
|
2
|
+
|
|
3
|
+
**mediasfu-shared** is the framework-agnostic WebRTC runtime at the core of the MediaSFU SDK family. It provides shared room helpers, mediasoup signaling, socket management, media state utilities, and TypeScript types for React, Vue, Angular, Svelte, and plain TypeScript. Install with `npm install mediasfu-shared`.
|
|
4
|
+
|
|
5
|
+
`mediasfu-shared` is the framework-agnostic MediaSFU runtime package. It exposes the shared room helpers, mediasoup/socket flows, state utilities, and TypeScript types used by the MediaSFU SDK family.
|
|
6
|
+
|
|
7
|
+
## When To Use This Package
|
|
8
|
+
|
|
9
|
+
Use `mediasfu-shared` when you want to:
|
|
10
|
+
|
|
11
|
+
- build your own browser client on top of MediaSFU primitives without adopting a framework-specific UI package
|
|
12
|
+
- share MediaSFU room, media, and participant logic across React, Vue, Angular, Svelte, or plain TypeScript codebases
|
|
13
|
+
- import low-level helpers such as `createRoomOnMediaSFU`, `joinRoomOnMediaSFU`, `connectSocket`, `SocketManager`, and the exported consumers, methods, and types entry points
|
|
14
|
+
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm install mediasfu-shared mediasoup-client socket.io-client
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
`mediasoup-client` and `socket.io-client` are peer dependencies, so install them in the host app.
|
|
22
|
+
|
|
23
|
+
## Backend Requirement
|
|
24
|
+
|
|
25
|
+
The cloud room helpers in this package target `https://mediasfu.com/v1/rooms/` by default.
|
|
26
|
+
|
|
27
|
+
- Use MediaSFU Cloud when you want managed room creation, signaling, and media routing. Pass `apiUserName` and `apiKey`.
|
|
28
|
+
- Use MediaSFU Open / Community Edition when you self-host. Pass a non-MediaSFU `localLink` such as `http://localhost:3000`.
|
|
29
|
+
|
|
30
|
+
## Quick Example
|
|
31
|
+
|
|
32
|
+
```ts
|
|
33
|
+
import {
|
|
34
|
+
SocketManager,
|
|
35
|
+
connectSocket,
|
|
36
|
+
createRoomOnMediaSFU,
|
|
37
|
+
joinRoomOnMediaSFU,
|
|
38
|
+
} from 'mediasfu-shared';
|
|
39
|
+
|
|
40
|
+
const createResult = await createRoomOnMediaSFU({
|
|
41
|
+
payload: {
|
|
42
|
+
action: 'create',
|
|
43
|
+
userName: 'Ada',
|
|
44
|
+
duration: 60,
|
|
45
|
+
capacity: 10,
|
|
46
|
+
},
|
|
47
|
+
apiUserName: 'your-api-username',
|
|
48
|
+
apiKey: 'your-64-character-api-key',
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
const joinResult = await joinRoomOnMediaSFU({
|
|
52
|
+
payload: {
|
|
53
|
+
action: 'join',
|
|
54
|
+
meetingID: 'room123',
|
|
55
|
+
userName: 'Ben',
|
|
56
|
+
},
|
|
57
|
+
apiUserName: 'your-api-username',
|
|
58
|
+
apiKey: 'your-64-character-api-key',
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
const socket = await connectSocket({
|
|
62
|
+
apiUserName: 'your-api-username',
|
|
63
|
+
apiKey: 'your-64-character-api-key',
|
|
64
|
+
apiToken: 'your-api-token',
|
|
65
|
+
link: 'https://mediasfu.com/socket',
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
const socketManager = new SocketManager({ socket });
|
|
69
|
+
|
|
70
|
+
console.log(createResult.success, joinResult.success, socketManager.socket.connected);
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Import Paths
|
|
74
|
+
|
|
75
|
+
- `mediasfu-shared` exposes the full public runtime surface.
|
|
76
|
+
- `mediasfu-shared/consumers` is useful when you want consumer/grid helpers only.
|
|
77
|
+
- `mediasfu-shared/methods` is useful when you want action utilities and room helpers.
|
|
78
|
+
- `mediasfu-shared/types` is useful when you only need TypeScript contracts.
|
|
79
|
+
|
|
80
|
+
## Documentation
|
|
81
|
+
|
|
82
|
+
- Main docs: [https://mediasfu.com/documentation](https://mediasfu.com/documentation)
|
|
83
|
+
- User guide: [https://mediasfu.com/user-guide](https://mediasfu.com/user-guide)
|
|
84
|
+
- MediaSFU Open / CE: [https://github.com/MediaSFU/MediaSFUOpen](https://github.com/MediaSFU/MediaSFUOpen)
|
|
85
|
+
|
|
86
|
+
Generate package-local API docs with:
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
npm run build-docs
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## Related Packages
|
|
93
|
+
|
|
94
|
+
| Package | Framework | npm |
|
|
95
|
+
|---------|-----------|-----|
|
|
96
|
+
| [mediasfu-reactjs](https://github.com/MediaSFU/MediaSFU-ReactJS) | React 18/19 | [`npm install mediasfu-reactjs`](https://www.npmjs.com/package/mediasfu-reactjs) |
|
|
97
|
+
| [mediasfu-vue](https://github.com/MediaSFU/MediaSFU-Vue) | Vue 3 / Composition API | [`npm install mediasfu-vue`](https://www.npmjs.com/package/mediasfu-vue) |
|
|
98
|
+
| [mediasfu-angular](https://github.com/MediaSFU/MediaSFU-Angular) | Angular 17/18/19 | [`npm install mediasfu-angular`](https://www.npmjs.com/package/mediasfu-angular) |
|
|
99
|
+
| [mediasfu-reactnative](https://www.npmjs.com/package/mediasfu-reactnative) | React Native | [`npm install mediasfu-reactnative`](https://www.npmjs.com/package/mediasfu-reactnative) |
|
|
100
|
+
|
|
101
|
+
## Support
|
|
102
|
+
|
|
103
|
+
- GitHub issues: [https://github.com/MediaSFU/MediaSFU-Shared/issues](https://github.com/MediaSFU/MediaSFU-Shared/issues)
|
|
104
|
+
- Email: info@mediasfu.com
|
|
105
|
+
|
|
106
|
+
## License
|
|
107
|
+
|
|
108
|
+
MIT. See [LICENSE](LICENSE).
|
package/package.json
CHANGED
|
@@ -1,96 +1,99 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "mediasfu-shared",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "
|
|
5
|
-
"main": "dist/index.cjs",
|
|
6
|
-
"module": "dist/index.js",
|
|
7
|
-
"types": "dist/index.d.ts",
|
|
8
|
-
"type": "module",
|
|
9
|
-
"exports": {
|
|
10
|
-
".": {
|
|
11
|
-
"types": "./dist/index.d.ts",
|
|
12
|
-
"import": "./dist/index.js",
|
|
13
|
-
"require": "./dist/index.cjs"
|
|
14
|
-
},
|
|
15
|
-
"./consumers": {
|
|
16
|
-
"types": "./dist/consumers/index.d.ts",
|
|
17
|
-
"import": "./dist/consumers/index.js",
|
|
18
|
-
"require": "./dist/consumers/index.cjs"
|
|
19
|
-
},
|
|
20
|
-
"./methods": {
|
|
21
|
-
"types": "./dist/methods/index.d.ts",
|
|
22
|
-
"import": "./dist/methods/index.js",
|
|
23
|
-
"require": "./dist/methods/index.cjs"
|
|
24
|
-
},
|
|
25
|
-
"./types": {
|
|
26
|
-
"types": "./dist/types/index.d.ts",
|
|
27
|
-
"import": "./dist/types/index.js",
|
|
28
|
-
"require": "./dist/types/index.cjs"
|
|
29
|
-
}
|
|
30
|
-
},
|
|
31
|
-
"files": [
|
|
32
|
-
"dist",
|
|
33
|
-
"src",
|
|
34
|
-
"README.md",
|
|
35
|
-
"LICENSE"
|
|
36
|
-
],
|
|
37
|
-
"scripts": {
|
|
38
|
-
"build": "tsc && vite build",
|
|
39
|
-
"build-docs": "typedoc",
|
|
40
|
-
"dev": "vite build --watch",
|
|
41
|
-
"test:staging:smoke": "npm run build && node ./scripts/staging-room-smoke-test.cjs",
|
|
42
|
-
"type-check": "tsc --noEmit"
|
|
43
|
-
},
|
|
44
|
-
"keywords": [
|
|
45
|
-
"mediasfu",
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"mediasoup",
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"video
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
"
|
|
59
|
-
"
|
|
60
|
-
"
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
"
|
|
64
|
-
"
|
|
65
|
-
"
|
|
66
|
-
"
|
|
67
|
-
"
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
"
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
"
|
|
86
|
-
},
|
|
87
|
-
"
|
|
88
|
-
"
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
"
|
|
92
|
-
"
|
|
93
|
-
"
|
|
94
|
-
"
|
|
95
|
-
|
|
96
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "mediasfu-shared",
|
|
3
|
+
"version": "1.0.4",
|
|
4
|
+
"description": "mediasfu-shared – framework-agnostic WebRTC runtime for MediaSFU. Room helpers, mediasoup signaling, socket management, media state, and TypeScript types for React, Vue, Angular, Svelte, and plain TS.",
|
|
5
|
+
"main": "dist/index.cjs",
|
|
6
|
+
"module": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"type": "module",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"import": "./dist/index.js",
|
|
13
|
+
"require": "./dist/index.cjs"
|
|
14
|
+
},
|
|
15
|
+
"./consumers": {
|
|
16
|
+
"types": "./dist/consumers/index.d.ts",
|
|
17
|
+
"import": "./dist/consumers/index.js",
|
|
18
|
+
"require": "./dist/consumers/index.cjs"
|
|
19
|
+
},
|
|
20
|
+
"./methods": {
|
|
21
|
+
"types": "./dist/methods/index.d.ts",
|
|
22
|
+
"import": "./dist/methods/index.js",
|
|
23
|
+
"require": "./dist/methods/index.cjs"
|
|
24
|
+
},
|
|
25
|
+
"./types": {
|
|
26
|
+
"types": "./dist/types/index.d.ts",
|
|
27
|
+
"import": "./dist/types/index.js",
|
|
28
|
+
"require": "./dist/types/index.cjs"
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"files": [
|
|
32
|
+
"dist",
|
|
33
|
+
"src",
|
|
34
|
+
"README.md",
|
|
35
|
+
"LICENSE"
|
|
36
|
+
],
|
|
37
|
+
"scripts": {
|
|
38
|
+
"build": "tsc && vite build",
|
|
39
|
+
"build-docs": "typedoc",
|
|
40
|
+
"dev": "vite build --watch",
|
|
41
|
+
"test:staging:smoke": "npm run build && node ./scripts/staging-room-smoke-test.cjs",
|
|
42
|
+
"type-check": "tsc --noEmit"
|
|
43
|
+
},
|
|
44
|
+
"keywords": [
|
|
45
|
+
"mediasfu",
|
|
46
|
+
"mediasfu-shared",
|
|
47
|
+
"webrtc",
|
|
48
|
+
"mediasoup",
|
|
49
|
+
"socket.io",
|
|
50
|
+
"sfu",
|
|
51
|
+
"video conferencing",
|
|
52
|
+
"video call",
|
|
53
|
+
"webinar",
|
|
54
|
+
"live streaming",
|
|
55
|
+
"recording",
|
|
56
|
+
"whiteboard",
|
|
57
|
+
"translation",
|
|
58
|
+
"live subtitles",
|
|
59
|
+
"room management",
|
|
60
|
+
"screen sharing",
|
|
61
|
+
"real-time communication",
|
|
62
|
+
"framework-agnostic",
|
|
63
|
+
"typescript",
|
|
64
|
+
"react",
|
|
65
|
+
"vue",
|
|
66
|
+
"angular",
|
|
67
|
+
"svelte",
|
|
68
|
+
"mediasfu sdk",
|
|
69
|
+
"mediasfu runtime",
|
|
70
|
+
"mediasfu shared"
|
|
71
|
+
],
|
|
72
|
+
"author": "MediaSFU",
|
|
73
|
+
"license": "MIT",
|
|
74
|
+
"repository": {
|
|
75
|
+
"type": "git",
|
|
76
|
+
"url": "https://github.com/MediaSFU/MediaSFU-Shared"
|
|
77
|
+
},
|
|
78
|
+
"homepage": "https://www.npmjs.com/package/mediasfu-shared",
|
|
79
|
+
"bugs": {
|
|
80
|
+
"url": "https://github.com/MediaSFU/MediaSFU-Shared/issues",
|
|
81
|
+
"email": "info@mediasfu.com"
|
|
82
|
+
},
|
|
83
|
+
"peerDependencies": {
|
|
84
|
+
"mediasoup-client": "^3.20.0",
|
|
85
|
+
"socket.io-client": "^4.8.0"
|
|
86
|
+
},
|
|
87
|
+
"dependencies": {
|
|
88
|
+
"universal-cookie": "^7.2.2"
|
|
89
|
+
},
|
|
90
|
+
"devDependencies": {
|
|
91
|
+
"mediasoup-client": "^3.20.0",
|
|
92
|
+
"socket.io-client": "^4.8.0",
|
|
93
|
+
"typedoc": "^0.28.14",
|
|
94
|
+
"typedoc-plugin-extras": "^4.0.1",
|
|
95
|
+
"typescript": "^5.9.3",
|
|
96
|
+
"vite": "^7.1.9",
|
|
97
|
+
"vite-plugin-dts": "^4.3.0"
|
|
98
|
+
}
|
|
99
|
+
}
|