senpai-webrtc-js
v0.2.0
Published
A WebRTC-based video call library with AI-powered transcription and nudging capabilities
Maintainers
Readme
senpai-webrtc-js
A WebRTC-based video call library with AI-powered transcription and nudging capabilities.
Installation
npm install senpai-webrtc-jsUsage
import { NudgeClient } from 'senpai-webrtc-js';
// Get references to your video elements
const localVideo = document.getElementById('local-video') as HTMLVideoElement;
const remoteVideo = document.getElementById('remote-video') as HTMLVideoElement;
// Create the client
const client = new NudgeClient(
{
peeringServiceUrl: 'https://your-peering-server.com',
senpaiServiceUrl: 'wss://your-senpai-server.com',
localPeerId: 'your_caller_id',
remotePeerId: 'callee_id',
localVideo,
remoteVideo,
},
{
onStatusChange: (status) => console.log('Status:', status),
onTranscriptionUpdate: (speaker, text) => console.log(`${speaker}: ${text}`),
onNudge: (text) => console.log('Nudge:', text)
}
);
// Initialize and start the call
await client.initialize();
await client.startCall({
transcriptionLanguages: ['en-US'], // Optional
aiPrompt: 'Your AI prompt here', // Optional
debugSenpai: false // Optional
});
// End the call
client.endCall();
// Cleanup
client.destroy();API
NudgeClient
Constructor
new NudgeClient(config: NudgeConfiguration, callbacks?: NudgeCallbacks)Methods
initialize(): Promise<void>- Initialize the client and request user mediastartCall(options: CallOptions): Promise<void>- Start a call with the remote peerendCall(): void- End the current calldestroy(): void- Cleanup and disconnectgetLocalPeerId(): string- Get the local peer IDgetRemotePeerId(): string- Get the remote peer IDisInCall(): boolean- Check if currently in a call
Development
# Install dependencies
bun install
# Build
bun run build
# The build outputs to ./distLicense
MIT
