pkc/video-call 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

pkc/video-call

最新稳定版本:v1.0.2

Composer 安装命令:

composer require pkc/video-call

包简介

Laravel video calling package using WebRTC and Laravel Reverb for real-time communication

README 文档

README

A robust Laravel package for implementing video calling functionality using WebRTC and Laravel Reverb for signaling. This package provides a simple way to add peer-to-peer video calls to your Laravel application without relying on external services like Pusher.

Features

  • 🎥 Real-time video and audio calls using WebRTC
  • 🔄 Laravel Reverb for WebSocket signaling
  • 🔒 Private channels for secure communication
  • 🎛️ Mute audio/video controls
  • 📱 Responsive design
  • 🚀 No external service dependencies
  • 🛠️ Easy to customize and extend

Requirements

  • PHP 8.1 or higher
  • Laravel 11.31
  • Laravel Reverb for WebSocket support
  • Modern browser with WebRTC support

Installation

  1. Install the package via Composer:
composer require kpr/video-call
  1. Publish the package assets:
php artisan vendor:publish --provider="kpr\VideoCall\VideoCallServiceProvider"
  1. Configure Laravel Reverb in your .env file:
BROADCAST_DRIVER=reverb
REVERB_APP_ID=your-app-id
REVERB_APP_KEY=your-app-key
REVERB_APP_SECRET=your-app-secret
REVERB_HOST=127.0.0.1
REVERB_PORT=8080
REVERB_SCHEME=http

Basic Usage

  1. Include the necessary JavaScript in your layout:
<!-- Add Font Awesome for icons -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">

<!-- Add Laravel Echo and Reverb client -->
<script src="{{ asset('vendor/reverb/reverb.js') }}"></script>
<script>
    window.Echo = new Echo({
        broadcaster: 'reverb',
        key: '{{ config('broadcasting.connections.reverb.key') }}',
        wsHost: window.location.hostname,
        wsPort: 8080,
        forceTLS: false,
        enabledTransports: ['ws', 'wss'],
    });
</script>
  1. Create a video call room:
Route::get('/video-call/{room}', function($room) {
    return view('video-call::room', [
        'room' => $room,
        'targetUserId' => request()->query('target_user'),
    ]);
})->middleware(['auth']);
  1. Start a video call:
// In your blade view
<a href="{{ route('video-call.room', ['room' => 'unique-room-id', 'target_user' => $userId]) }}">
    Start Video Call
</a>

Configuration

You can modify the package configuration in config/video-call.php:

return [
    'stun_servers' => [
        'stun:stun.l.google.com:19302',
        'stun:stun1.l.google.com:19302',
    ],
    'turn_servers' => [
        // Add your TURN servers here
        // [
        //     'urls' => 'turn:your-turn-server.com:3478',
        //     'username' => 'username',
        //     'credential' => 'credential'
        // ]
    ],
    'video_constraints' => [
        'width' => 640,
        'height' => 480,
        'frameRate' => 30,
    ],
];

Events

The package broadcasts the following events:

  • VideoCallSignal: Handles WebRTC signaling between peers

Security

  • Uses private channels for signaling
  • All routes are protected by authentication middleware
  • WebRTC connections are encrypted by default
  • TURN servers should be configured in production for NAT traversal

Production Considerations

  1. Use HTTPS in production
  2. Configure TURN servers for reliable connectivity
  3. Implement proper user authorization
  4. Consider scaling WebSocket connections
  5. Monitor server resources

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This package is open-sourced software licensed under the MIT license.

Credits

  • Author: Roktim Ariyan
  • Built with Laravel and WebRTC
  • Special thanks to the Laravel community

Support

For support, please create an issue in the GitHub repository or contact the author directly.

统计信息

  • 总下载量: 9
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 1
  • 开发语言: JavaScript

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-05-23