google-meeting-captions-resolver
v2.0.0
Published
a tool to get google meeting captions for chrome extension
Readme
🎯 Google Meeting Captions Resolver
Real-time caption extraction for Google Meet - Perfect for building Chrome extensions, accessibility tools, live translations, and meeting assistants!
✨ Features
- 🚀 High Performance - Optimized with WeakMap and smart DOM tracking (7-10x faster than naive implementations)
- 🎯 Zero Data Loss - Captures every caption update in real-time, no debouncing
- 🔄 Session Tracking - Automatically tracks speaker sessions with unique IDs
- 🌍 Multi-language - Supports both English and Chinese Google Meet interfaces
- 💪 TypeScript - Full type definitions included
- 🪶 Lightweight - Minimal dependencies, small bundle size
📦 Installation
npm install google-meeting-captions-resolveror
yarn add google-meeting-captions-resolver🚀 Quick Start
import { getCaptions } from 'google-meeting-captions-resolver';
getCaptions('', (captions) => {
console.log(`${captions.activeSpeaker}: ${captions.talkContent}`);
// Output: "John Doe: Hello everyone, welcome to the meeting!"
});📖 API Reference
getCaptions(cls: string, receiver: captionsReceiver): void
Starts monitoring Google Meet captions and calls your receiver function whenever captions change.
Parameters:
cls(string): Custom class name (currently unused, pass empty string'')receiver(function): Callback function that receives caption updates
Receiver Callback:
type captionsReceiver = (captions: Captions) => void;
interface Captions {
session: string; // Unique session ID for this caption block
activeSpeaker: string; // Name of the current speaker
talkContent: string; // The caption text content
}💡 Usage Examples
Basic Chrome Extension
import { getCaptions } from 'google-meeting-captions-resolver';
// Start capturing captions
getCaptions('', (captions) => {
// Send to your backend
fetch('/api/captions', {
method: 'POST',
body: JSON.stringify(captions)
});
});Live Translation
import { getCaptions } from 'google-meeting-captions-resolver';
getCaptions('', async (captions) => {
// Translate captions in real-time
const translated = await translateText(captions.talkContent, 'es');
displayTranslation(translated);
});Meeting Transcription
import { getCaptions } from 'google-meeting-captions-resolver';
const transcript = new Map();
getCaptions('', (captions) => {
// Group by session ID
if (!transcript.has(captions.session)) {
transcript.set(captions.session, {
speaker: captions.activeSpeaker,
content: []
});
}
transcript.get(captions.session).content.push(captions.talkContent);
});Accessibility Enhancement
import { getCaptions } from 'google-meeting-captions-resolver';
getCaptions('', (captions) => {
// Display captions in a custom, larger font
const captionElement = document.getElementById('custom-captions');
captionElement.innerHTML = `
<strong>${captions.activeSpeaker}:</strong>
<span style="font-size: 24px">${captions.talkContent}</span>
`;
});🏗️ How It Works
This library uses the powerful MutationObserver API to monitor Google Meet's caption container in real-time:
- Smart Detection - Automatically finds the caption container (supports multiple languages)
- Efficient Tracking - Only processes changed nodes, not the entire DOM
- Session Management - Uses WeakMap for O(1) lookups and automatic memory cleanup
- Content Deduplication - Only triggers callbacks when content actually changes
🎯 Use Cases
- 📝 Meeting Transcription - Save and archive meeting conversations
- 🌐 Live Translation - Translate captions to other languages in real-time
- ♿ Accessibility Tools - Enhance caption display for better readability
- 🤖 AI Assistants - Feed captions to AI for meeting summaries or action items
- 📊 Analytics - Track speaking time, keywords, and participation
- 🎓 Education - Help students follow along in virtual classrooms
🔧 Browser Compatibility
Works in all modern browsers that support:
- MutationObserver API
- WeakMap
- ES2015+
Tested on:
- ✅ Chrome 90+
- ✅ Edge 90+
- ✅ Firefox 88+
- ✅ Safari 14+
📝 TypeScript Support
Full TypeScript definitions are included:
import { getCaptions, Captions, captionsReceiver } from 'google-meeting-captions-resolver';
const handleCaptions: captionsReceiver = (captions: Captions) => {
// Your code here with full type safety
};
getCaptions('', handleCaptions);🤝 Contributing
Contributions are welcome! Feel free to:
- 🐛 Report bugs
- 💡 Suggest new features
- 🔧 Submit pull requests
Visit our GitHub repository to get started.
📄 License
ISC License - see LICENSE for details.
🙏 Acknowledgments
Built with ❤️ for developers creating amazing Google Meet extensions and accessibility tools.
📮 Support
- 🐛 Issues: GitHub Issues
Happy coding! 🚀 If this library helps you, consider giving it a ⭐ on GitHub!
