@api.video/browser-to-rtmp-client
Advanced tools
Comparing version 0.2.0 to 0.2.1
@@ -0,1 +1,2 @@ | ||
import { ManagerOptions, SocketOptions } from "socket.io-client"; | ||
import TypedEmitter from "typed-emitter"; | ||
@@ -6,2 +7,3 @@ import { ServerError, FfmpegConfig } from "./types"; | ||
port?: number; | ||
socketio?: Partial<ManagerOptions & SocketOptions>; | ||
} & FfmpegConfig; | ||
@@ -8,0 +10,0 @@ export declare type BrowserToRtmpClientEvents = { |
{ | ||
"name": "@api.video/browser-to-rtmp-client", | ||
"description": "Library to broadcast the stream of a webcam from the browser to an RTMP server (client part).", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"main": "dist/index.js", | ||
@@ -6,0 +6,0 @@ "module": "dist/index.js", |
@@ -290,2 +290,3 @@ [![badge](https://img.shields.io/twitter/follow/api_video?style=social)](https://twitter.com/intent/follow?screen_name=api_video) [![badge](https://img.shields.io/github/stars/apivideo/api.video-browser-to-rtmp?style=social)](https://github.com/apivideo/api.video-browser-to-rtmp) [![badge](https://img.shields.io/discourse/topics?server=https%3A%2F%2Fcommunity.api.video)](https://community.api.video) | ||
audioSampleRate?: number; // the sample rate for audio (default: audioBitsPerSecond / 4) | ||
socketio?: Partial<ManagerOptions & SocketOptions>; // socket.io client options (see https://socket.io/docs/v4/client-options/) | ||
} | ||
@@ -292,0 +293,0 @@ ``` |
import { EventEmitter } from 'events'; | ||
import { io, Socket } from "socket.io-client"; | ||
import { io, Manager, ManagerOptions, Socket, SocketOptions } from "socket.io-client"; | ||
import TypedEmitter from "typed-emitter"; | ||
@@ -9,2 +9,3 @@ import { ServerToClientEvents, ClientToServerEvents, ServerError, FfmpegConfig } from "./types" | ||
port?: number; | ||
socketio?: Partial<ManagerOptions & SocketOptions> | ||
} & FfmpegConfig; | ||
@@ -44,4 +45,10 @@ | ||
} | ||
this.socket = io(`ws://${options.host}:${options.port}`, { reconnectionDelayMax: 10000 }); | ||
const socketOptions = { | ||
reconnectionDelayMax: 10000, | ||
...(options.socketio || {}) | ||
} | ||
this.socket = io(`ws://${options.host}:${options.port}`, socketOptions); | ||
this.socket.on('error', (err: ServerError) => this.onRemoteError(err)); | ||
@@ -48,0 +55,0 @@ this.socket.on('ffmpegOutput', (msg: string) => this.emit('ffmpegOutput', msg)); |
Sorry, the diff of this file is too big to display
111722
238
345