Initial Commit

This commit is contained in:
2025-08-17 11:41:43 -04:00
commit a3078c13b1
10 changed files with 846 additions and 0 deletions

87
README.md Normal file
View File

@@ -0,0 +1,87 @@
# RTMP Push Tool
A TypeScript library for pushing media streams to RTMP servers using FFmpeg.
## Features
- Push media streams to RTMP servers
- Support for various media formats (H.264, AAC, etc.)
- Configurable capabilities and stream keys
- Process management and monitoring
- TypeScript support
## Installation
```bash
bun install
```
## Usage
```typescript
import { RtmpPush } from '@techniker-me/rtmp-push';
const rtmpPush = new RtmpPush(
'https://example.com/video.ts',
'rtmp://ingest.example.com:80/ingest'
);
// Start streaming
rtmpPush.start('stream-key', ['h264', 'aac']);
// Check if running
if (rtmpPush.isRunning()) {
console.log('Stream is active');
}
// Stop streaming
rtmpPush.stop();
```
## Testing
This package includes comprehensive tests for all features:
### Run all tests
```bash
bun test
```
### Run tests in watch mode
```bash
bun test --watch
```
### Run tests with coverage
```bash
bun test --coverage
```
### Test Structure
- **Unit Tests** (`RtmpPush.test.ts`): Test individual methods and edge cases with mocked dependencies
- **Integration Tests** (`RtmpPush.integration.test.ts`): Test real functionality and error handling
### Test Coverage
The test suite covers:
- ✅ Constructor and property initialization
- ✅ Getter methods
- ✅ Start method with various parameters
- ✅ Stop method and process cleanup
- ✅ Process lifecycle management
- ✅ Error handling and edge cases
- ✅ URI construction and validation
- ✅ FFmpeg command generation
- ✅ Process event handling
## Requirements
- Bun runtime
- FFmpeg installed on the system (for actual streaming)
- TypeScript 5+
## License
MIT