Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
133 changes: 133 additions & 0 deletions EMOJI_REACTIONS_FEATURE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
# Emoji Reactions Feature

## Overview
This feature adds real-time emoji reactions to the Multi-Peer Voice Chat application, allowing participants to express emotions during calls through animated emoji that float across the screen.

## Features Implemented

### 1. ✨ Emoji Reaction UI
- **8 Quick Reaction Buttons**: 👍 ❤️ 😂 🎉 👏 🔥 😮 😢
- Beautiful, responsive design with hover effects
- Disabled when not in a call
- Located in a dedicated section below peer list

### 2. 📡 Data Channel Communication
- **DataChannelManager**: New utility class to manage WebRTC data channels
- Sends reactions to all connected peers in real-time
- Handles incoming reactions from other participants
- Automatic channel setup/teardown with peer connections

### 3. 💫 Floating Reaction Animations
- Smooth floating animation from bottom to top
- Random horizontal positioning for variety
- 3-second animation duration
- Scale and rotation effects for natural movement
- Automatic cleanup after animation completes

### 4. 🔗 Integration with Existing System
- Seamlessly integrated with MultiPeerManager
- Data channels created alongside audio connections
- Proper cleanup when peers disconnect or call ends
- No impact on existing voice chat functionality

## Technical Implementation

### New Files Created

1. **`src/components/EmojiReactions.jsx`**
- Main component for emoji reaction UI and animations
- Manages reaction state and display
- Handles sending/receiving reactions

2. **`src/utils/DataChannelManager.js`**
- Manages WebRTC data channels
- Provides broadcast functionality
- Handles channel lifecycle

### Modified Files

1. **`src/pages/App.jsx`**
- Added EmojiReactions component
- Initialized DataChannelManager
- Connected manager to MultiPeerManager

2. **`src/utils/MultiPeerManager.js`**
- Added data channel support
- Setup channels during peer connection
- Cleanup channels on disconnect

3. **`src/assets/styles.css`**
- Added emoji button styles
- Floating animation keyframes
- Responsive design for mobile

## Usage

### For Users
1. Start a group call with peers
2. Click any emoji button to send a reaction
3. See your reaction float up the screen
4. Receive and see reactions from other participants

### For Developers
```javascript
// Send a reaction
dataChannelManager.broadcast({
type: 'reaction',
emoji: '👍',
peerId: 'sender-id',
timestamp: Date.now()
});

// Listen for reactions
dataChannelManager.onMessage = (data) => {
if (data.type === 'reaction') {
// Handle reaction
}
};
```

## Browser Compatibility
- Chrome/Edge: ✅ Full support
- Firefox: ✅ Full support
- Safari: ✅ Full support
- Opera: ✅ Full support

## Performance Considerations
- Lightweight JSON messages (~50 bytes per reaction)
- Efficient animation using CSS transforms
- Automatic cleanup prevents memory leaks
- No impact on voice quality

## Future Enhancements
- [ ] Custom emoji picker
- [ ] Reaction history/stats
- [ ] Sound effects for reactions
- [ ] Reaction clustering for multiple simultaneous reactions
- [ ] User preferences for reaction size/speed

## Testing
To test the feature:
1. Open the app in multiple browser tabs/windows
2. Connect peers and start a call
3. Send reactions from different peers
4. Verify animations appear on all connected peers

## Contributing
This feature was implemented as part of Hacktoberfest 2025! 🎉

### Issue Reference
Closes issue: Add emoji reaction buttons with floating animations

### Changes Summary
- ✅ Add emoji reaction UI
- ✅ Send reactions via data channel
- ✅ Display reactions in chat
- ✅ Add floating reaction animations

## License
Same as parent project (MIT)

---

Built with ❤️ for Hacktoberfest 2025
9 changes: 6 additions & 3 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
<!doctype html>
<!-- index.html -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Local Wi‑Fi P2P voice chat using WebRTC (PeerJS)" />
<title>Local P2P Voice Chat</title>
<meta name="description" content="Zero-backend, end-to-end encrypted multi-peer voice chat using WebRTC and PeerJS" />
<meta name="keywords" content="WebRTC, PeerJS, voice chat, P2P, group call" />
<title>Multi-Peer Voice Chat</title>
</head>
<body>
<div id="root"></div>
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading