@encarnage7/local-meet 1.0.0 → 1.0.1
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 +176 -21
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -7,42 +7,42 @@
|
|
|
7
7
|
|
|
8
8
|
---
|
|
9
9
|
|
|
10
|
-
##
|
|
10
|
+
## Características
|
|
11
11
|
|
|
12
|
-
-
|
|
13
|
-
-
|
|
14
|
-
-
|
|
15
|
-
-
|
|
16
|
-
-
|
|
17
|
-
-
|
|
18
|
-
-
|
|
12
|
+
- **Cero Dependencias en Runtime**: Ligera, rápida y empaquetada en ESM, CommonJS y Browser UMD.
|
|
13
|
+
- **Doble Arquitectura**: Funciona en modo **WebRTC P2P Mesh Ilimitado** (gratis, sin servidores de medios) y **Cloudflare Calls SFU** (1,000 GB/mes gratis).
|
|
14
|
+
- **Señalización Ultrarresistente por HTTPS**: Supera firewalls restrictivos, NAT simétrico y redes móviles 4G/5G gracias a su bus de respaldo HTTPS `/api/room-sync`.
|
|
15
|
+
- **Cifrado de Extremo a Extremo (E2EE)**: Mensajería de datos, chat y reacciones cifradas con AES-GCM-256 mediante Web Crypto API.
|
|
16
|
+
- **Pantalla Compartida Nativa**: Conexión directa y fluida sin pantallas negras.
|
|
17
|
+
- **Sala de Espera y Controles de Anfitrión**: Admitir, rechazar, silenciar micrófonos, expulsar y finalizar salas para todos.
|
|
18
|
+
- **Soporte TypeScript Completo**: Definiciones de tipos `.d.ts` incluidas.
|
|
19
19
|
|
|
20
20
|
---
|
|
21
21
|
|
|
22
|
-
##
|
|
22
|
+
## Instalación
|
|
23
23
|
|
|
24
|
-
### Vía NPM (React, Next.js, Vue, Svelte, Vite)
|
|
24
|
+
### Vía NPM (React, Next.js, Vue, Angular, Svelte, Vite)
|
|
25
25
|
```bash
|
|
26
|
-
npm install local-meet
|
|
26
|
+
npm install @encarnage7/local-meet
|
|
27
27
|
```
|
|
28
28
|
|
|
29
29
|
### Vía CDN (HTML directo sin bundler, igual que Axios)
|
|
30
30
|
```html
|
|
31
|
-
<script src="https://cdn.jsdelivr.net/npm/local-meet@1.0.0/dist/local-meet.min.js"></script>
|
|
31
|
+
<script src="https://cdn.jsdelivr.net/npm/@encarnage7/local-meet@1.0.0/dist/local-meet.min.js"></script>
|
|
32
32
|
```
|
|
33
33
|
*(O a través de unpkg)*:
|
|
34
34
|
```html
|
|
35
|
-
<script src="https://unpkg.com/local-meet@1.0.0/dist/local-meet.min.js"></script>
|
|
35
|
+
<script src="https://unpkg.com/@encarnage7/local-meet@1.0.0/dist/local-meet.min.js"></script>
|
|
36
36
|
```
|
|
37
37
|
|
|
38
38
|
---
|
|
39
39
|
|
|
40
|
-
##
|
|
40
|
+
## Inicio Rápido
|
|
41
41
|
|
|
42
42
|
### 1. Unirse como Invitado (3 líneas)
|
|
43
43
|
|
|
44
44
|
```javascript
|
|
45
|
-
import { LocalMeet, RoomEvents } from "local-meet";
|
|
45
|
+
import { LocalMeet, RoomEvents } from "@encarnage7/local-meet";
|
|
46
46
|
|
|
47
47
|
// 1. Conectar a la sala
|
|
48
48
|
const room = await LocalMeet.join({
|
|
@@ -67,7 +67,7 @@ await room.enableCameraAndMicrophone();
|
|
|
67
67
|
### 2. Crear una Sala como Anfitrión
|
|
68
68
|
|
|
69
69
|
```javascript
|
|
70
|
-
import { LocalMeet, RoomEvents, EngineModes } from "local-meet";
|
|
70
|
+
import { LocalMeet, RoomEvents, EngineModes } from "@encarnage7/local-meet";
|
|
71
71
|
|
|
72
72
|
const room = await LocalMeet.createRoom({
|
|
73
73
|
serverUrl: "https://tu-worker.workers.dev",
|
|
@@ -91,11 +91,166 @@ await room.enableCameraAndMicrophone();
|
|
|
91
91
|
|
|
92
92
|
---
|
|
93
93
|
|
|
94
|
-
### 3. Ejemplo con
|
|
94
|
+
### 3. Ejemplo con Vue 3 (Composition API / `<script setup>`)
|
|
95
|
+
|
|
96
|
+
```vue
|
|
97
|
+
<script setup>
|
|
98
|
+
import { ref, onMounted, onUnmounted } from "vue";
|
|
99
|
+
import { LocalMeet, RoomEvents } from "@encarnage7/local-meet";
|
|
100
|
+
|
|
101
|
+
const props = defineProps({
|
|
102
|
+
roomHash: { type: String, required: true },
|
|
103
|
+
userName: { type: String, default: "Invitado" },
|
|
104
|
+
serverUrl: { type: String, default: "https://tu-worker.workers.dev" }
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
const videoContainer = ref(null);
|
|
108
|
+
let room = null;
|
|
109
|
+
|
|
110
|
+
onMounted(async () => {
|
|
111
|
+
room = await LocalMeet.join({
|
|
112
|
+
serverUrl: props.serverUrl,
|
|
113
|
+
roomHash: props.roomHash,
|
|
114
|
+
guestName: props.userName,
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
room.on(RoomEvents.TrackSubscribed, (track) => {
|
|
118
|
+
const el = track.attach();
|
|
119
|
+
videoContainer.value?.appendChild(el);
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
room.on(RoomEvents.TrackUnsubscribed, (track) => {
|
|
123
|
+
track.detach().forEach((el) => el.remove());
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
await room.connect();
|
|
127
|
+
await room.enableCameraAndMicrophone();
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
onUnmounted(() => {
|
|
131
|
+
room?.disconnect();
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
const toggleMic = () => room?.setMicrophoneEnabled(false);
|
|
135
|
+
const toggleScreen = () => room?.startScreenShare();
|
|
136
|
+
const leave = () => room?.disconnect();
|
|
137
|
+
</script>
|
|
138
|
+
|
|
139
|
+
<template>
|
|
140
|
+
<div class="meeting-room">
|
|
141
|
+
<div ref="videoContainer" class="video-grid"></div>
|
|
142
|
+
<div class="controls">
|
|
143
|
+
<button @click="toggleMic">Silenciar Micrófono</button>
|
|
144
|
+
<button @click="toggleScreen">Compartir Pantalla</button>
|
|
145
|
+
<button @click="leave">Salir de la Reunión</button>
|
|
146
|
+
</div>
|
|
147
|
+
</div>
|
|
148
|
+
</template>
|
|
149
|
+
|
|
150
|
+
<style scoped>
|
|
151
|
+
.video-grid {
|
|
152
|
+
display: grid;
|
|
153
|
+
grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
|
|
154
|
+
gap: 12px;
|
|
155
|
+
}
|
|
156
|
+
.controls {
|
|
157
|
+
margin-top: 16px;
|
|
158
|
+
display: flex;
|
|
159
|
+
gap: 8px;
|
|
160
|
+
}
|
|
161
|
+
</style>
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
---
|
|
165
|
+
|
|
166
|
+
### 4. Ejemplo con Angular (Standalone Component / TypeScript)
|
|
167
|
+
|
|
168
|
+
```typescript
|
|
169
|
+
import { Component, ElementRef, Input, OnDestroy, OnInit, ViewChild } from '@angular/core';
|
|
170
|
+
import { CommonModule } from '@angular/common';
|
|
171
|
+
import { LocalMeet, LocalMeetRoom, RoomEvents } from '@encarnage7/local-meet';
|
|
172
|
+
|
|
173
|
+
@Component({
|
|
174
|
+
selector: 'app-video-meeting',
|
|
175
|
+
standalone: true,
|
|
176
|
+
imports: [CommonModule],
|
|
177
|
+
template: `
|
|
178
|
+
<div class="meeting-room">
|
|
179
|
+
<div #videoContainer class="video-grid"></div>
|
|
180
|
+
<div class="controls">
|
|
181
|
+
<button (click)="toggleScreen()">Compartir Pantalla</button>
|
|
182
|
+
<button (click)="toggleMic()">Silenciar</button>
|
|
183
|
+
<button (click)="leave()">Salir</button>
|
|
184
|
+
</div>
|
|
185
|
+
</div>
|
|
186
|
+
`,
|
|
187
|
+
styles: [`
|
|
188
|
+
.video-grid {
|
|
189
|
+
display: grid;
|
|
190
|
+
grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
|
|
191
|
+
gap: 12px;
|
|
192
|
+
}
|
|
193
|
+
.controls {
|
|
194
|
+
margin-top: 16px;
|
|
195
|
+
display: flex;
|
|
196
|
+
gap: 8px;
|
|
197
|
+
}
|
|
198
|
+
`]
|
|
199
|
+
})
|
|
200
|
+
export class VideoMeetingComponent implements OnInit, OnDestroy {
|
|
201
|
+
@Input() roomHash!: string;
|
|
202
|
+
@Input() userName: string = 'Invitado';
|
|
203
|
+
@Input() serverUrl: string = 'https://tu-worker.workers.dev';
|
|
204
|
+
|
|
205
|
+
@ViewChild('videoContainer', { static: true }) videoContainer!: ElementRef<HTMLDivElement>;
|
|
206
|
+
|
|
207
|
+
private room?: LocalMeetRoom;
|
|
208
|
+
|
|
209
|
+
async ngOnInit() {
|
|
210
|
+
this.room = await LocalMeet.join({
|
|
211
|
+
serverUrl: this.serverUrl,
|
|
212
|
+
roomHash: this.roomHash,
|
|
213
|
+
guestName: this.userName,
|
|
214
|
+
});
|
|
215
|
+
|
|
216
|
+
this.room.on(RoomEvents.TrackSubscribed, (track) => {
|
|
217
|
+
const el = track.attach();
|
|
218
|
+
this.videoContainer.nativeElement.appendChild(el);
|
|
219
|
+
});
|
|
220
|
+
|
|
221
|
+
this.room.on(RoomEvents.TrackUnsubscribed, (track) => {
|
|
222
|
+
track.detach().forEach((el) => el.remove());
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
await this.room.connect();
|
|
226
|
+
await this.room.enableCameraAndMicrophone();
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
ngOnDestroy() {
|
|
230
|
+
this.room?.disconnect();
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
toggleMic() {
|
|
234
|
+
this.room?.setMicrophoneEnabled(false);
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
toggleScreen() {
|
|
238
|
+
this.room?.startScreenShare();
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
leave() {
|
|
242
|
+
this.room?.disconnect();
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
---
|
|
248
|
+
|
|
249
|
+
### 5. Ejemplo con React / Next.js
|
|
95
250
|
|
|
96
251
|
```jsx
|
|
97
252
|
import React, { useEffect, useRef, useState } from "react";
|
|
98
|
-
import { LocalMeet, RoomEvents } from "local-meet";
|
|
253
|
+
import { LocalMeet, RoomEvents } from "@encarnage7/local-meet";
|
|
99
254
|
|
|
100
255
|
export function VideoMeeting({ roomHash, userName }) {
|
|
101
256
|
const [room, setRoom] = useState(null);
|
|
@@ -187,7 +342,7 @@ export function VideoMeeting({ roomHash, userName }) {
|
|
|
187
342
|
|
|
188
343
|
---
|
|
189
344
|
|
|
190
|
-
##
|
|
345
|
+
## Referencia de API
|
|
191
346
|
|
|
192
347
|
### `LocalMeet`
|
|
193
348
|
- `LocalMeet.createRoom(options)`: Petición a `/api/host-join` y retorno de instancia `LocalMeetRoom`.
|
|
@@ -218,7 +373,7 @@ export function VideoMeeting({ roomHash, userName }) {
|
|
|
218
373
|
|
|
219
374
|
---
|
|
220
375
|
|
|
221
|
-
##
|
|
376
|
+
## ¿Cómo Publicar esta Librería en NPM?
|
|
222
377
|
|
|
223
378
|
Si deseas publicar tu paquete bajo tu cuenta de npm (ej: `mi-libreria` o `@mi-usuario/local-meet`):
|
|
224
379
|
|
|
@@ -244,6 +399,6 @@ Si deseas publicar tu paquete bajo tu cuenta de npm (ej: `mi-libreria` o `@mi-us
|
|
|
244
399
|
|
|
245
400
|
---
|
|
246
401
|
|
|
247
|
-
##
|
|
402
|
+
## Licencia
|
|
248
403
|
|
|
249
404
|
MIT © Local Meet Contributors
|
package/package.json
CHANGED