sip-connector 19.8.2 → 19.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -101
- package/dist/{@SipConnector-aZtI_w3L.js → @SipConnector-BpypVXj0.js} +586 -747
- package/dist/@SipConnector-CR3DyIpB.cjs +1 -0
- package/dist/ApiManager/@ApiManager.d.ts +0 -1
- package/dist/ApiManager/constants.d.ts +3 -8
- package/dist/ApiManager/eventNames.d.ts +7 -5
- package/dist/ApiManager/index.d.ts +0 -1
- package/dist/ApiManager/types.d.ts +0 -6
- package/dist/CallManager/@CallManager.d.ts +30 -15
- package/dist/CallManager/MCUSession.d.ts +0 -1
- package/dist/CallManager/RecvSession.d.ts +29 -0
- package/dist/CallManager/index.d.ts +0 -1
- package/dist/CallManager/types.d.ts +13 -31
- package/dist/SipConnector/@SipConnector.d.ts +0 -2
- package/dist/SipConnector/eventNames.d.ts +1 -1
- package/dist/__fixtures__/RTCPeerConnectionMock.d.ts +13 -17
- package/dist/__fixtures__/flushPromises.d.ts +2 -0
- package/dist/doMock.cjs +1 -1
- package/dist/doMock.js +131 -130
- package/dist/index.cjs +1 -1
- package/dist/index.js +2 -2
- package/package.json +13 -5
- package/dist/@SipConnector-XZVpmnm7.cjs +0 -1
- package/dist/CallManager/AbstractCallStrategy.d.ts +0 -54
- package/dist/CallManager/MCUCallStrategy.d.ts +0 -31
- package/dist/TransceiverManager/@TransceiverManager.d.ts +0 -70
- package/dist/TransceiverManager/index.d.ts +0 -1
- package/dist/TransceiverManager/types.d.ts +0 -11
package/README.md
CHANGED
|
@@ -31,8 +31,6 @@ SDK предоставляет комплексное решение для:
|
|
|
31
31
|
- **Обработка смены треков**: Автоматическая адаптация балансировки при изменении видеотреков
|
|
32
32
|
- **Улучшенная статистика**: Расширенные возможности сбора и анализа WebRTC статистики
|
|
33
33
|
- **Автоматический перезапуск ICE**: Обработка событий `restart` от сервера с автоматическим вызовом `restartIce`
|
|
34
|
-
- **Управление transceiver'ами**: Новый `TransceiverManager` для отслеживания и управления RTCRtpTransceiver'ами
|
|
35
|
-
- **Автоматическое добавление transceiver'ов**: Умное добавление презентационных transceiver'ов при событиях restart
|
|
36
34
|
|
|
|
37
35
|
|
|
38
36
|
### 🏗️ Архитектура
|
|
@@ -428,100 +426,6 @@ sipConnector.on('api:restart', (data) => {
|
|
|
428
426
|
|
|
429
427
|
---
|
|
430
428
|
|
|
431
|
-
## 🎛️ Управление RTCRtpTransceiver'ами
|
|
432
|
-
|
|
433
|
-
### Обзор TransceiverManager
|
|
434
|
-
|
|
435
|
-
SDK автоматически отслеживает и управляет RTCRtpTransceiver'ами через новый класс `TransceiverManager`:
|
|
436
|
-
|
|
437
|
-
```typescript
|
|
438
|
-
// Получение текущих transceiver'ов
|
|
439
|
-
const transceivers = sipConnector.callManager.getTransceivers();
|
|
440
|
-
|
|
441
|
-
console.log('Основной аудио transceiver:', transceivers.mainAudio);
|
|
442
|
-
console.log('Основной видео transceiver:', transceivers.mainVideo);
|
|
443
|
-
console.log('Презентационный видео transceiver:', transceivers.presentationVideo);
|
|
444
|
-
```
|
|
445
|
-
|
|
446
|
-
### Типы transceiver'ов
|
|
447
|
-
|
|
448
|
-
SDK автоматически классифицирует transceiver'ы по их `mid` значению:
|
|
449
|
-
|
|
450
|
-
| Тип transceiver'а | mid | Назначение |
|
|
451
|
-
| ------------------- | --- | --------------------------- |
|
|
452
|
-
| `mainAudio` | '0' | Основной аудио поток |
|
|
453
|
-
| `mainVideo` | '1' | Основной видео поток |
|
|
454
|
-
| `presentationVideo` | '2' | Презентационный видео поток |
|
|
455
|
-
|
|
456
|
-
### Автоматическое добавление transceiver'ов
|
|
457
|
-
|
|
458
|
-
При получении события `restart` с `videoTrackCount === 2`, SDK автоматически добавляет презентационный transceiver если он отсутствует:
|
|
459
|
-
|
|
460
|
-
```typescript
|
|
461
|
-
// SDK автоматически обрабатывает события restart
|
|
462
|
-
sipConnector.on('api:restart', (data) => {
|
|
463
|
-
if (data.videoTrackCount === 2) {
|
|
464
|
-
// SDK проверит наличие presentationVideo transceiver'а
|
|
465
|
-
// и добавит его автоматически если необходимо
|
|
466
|
-
console.log('Будет добавлен презентационный transceiver');
|
|
467
|
-
}
|
|
468
|
-
});
|
|
469
|
-
```
|
|
470
|
-
|
|
471
|
-
### Ручное управление transceiver'ами
|
|
472
|
-
|
|
473
|
-
```typescript
|
|
474
|
-
// Добавление нового transceiver'а
|
|
475
|
-
try {
|
|
476
|
-
const audioTransceiver = await sipConnector.callManager.addTransceiver('audio', {
|
|
477
|
-
direction: 'sendrecv',
|
|
478
|
-
});
|
|
479
|
-
|
|
480
|
-
const videoTransceiver = await sipConnector.callManager.addTransceiver('video', {
|
|
481
|
-
direction: 'sendonly',
|
|
482
|
-
sendEncodings: [
|
|
483
|
-
{ rid: 'low', maxBitrate: 500_000, scaleResolutionDownBy: 4 },
|
|
484
|
-
{ rid: 'high', maxBitrate: 2_000_000, scaleResolutionDownBy: 1 },
|
|
485
|
-
],
|
|
486
|
-
});
|
|
487
|
-
|
|
488
|
-
console.log('Transceiver'ы добавлены:', { audioTransceiver, videoTransceiver });
|
|
489
|
-
} catch (error) {
|
|
490
|
-
console.error('Ошибка добавления transceiver'а:', error);
|
|
491
|
-
}
|
|
492
|
-
```
|
|
493
|
-
|
|
494
|
-
### Мониторинг transceiver'ов
|
|
495
|
-
|
|
496
|
-
```typescript
|
|
497
|
-
// Проверка состояния transceiver'ов
|
|
498
|
-
const checkTransceivers = () => {
|
|
499
|
-
const transceivers = sipConnector.callManager.getTransceivers();
|
|
500
|
-
|
|
501
|
-
console.log('Статус transceiver'ов:', {
|
|
502
|
-
hasAudio: transceivers.mainAudio !== undefined,
|
|
503
|
-
hasVideo: transceivers.mainVideo !== undefined,
|
|
504
|
-
hasPresentation: transceivers.presentationVideo !== undefined,
|
|
505
|
-
});
|
|
506
|
-
|
|
507
|
-
// Детальная информация
|
|
508
|
-
if (transceivers.mainVideo) {
|
|
509
|
-
console.log('Основное видео:', {
|
|
510
|
-
mid: transceivers.mainVideo.mid,
|
|
511
|
-
direction: transceivers.mainVideo.direction,
|
|
512
|
-
currentDirection: transceivers.mainVideo.currentDirection,
|
|
513
|
-
});
|
|
514
|
-
}
|
|
515
|
-
};
|
|
516
|
-
|
|
517
|
-
// Проверка после установки соединения
|
|
518
|
-
sipConnector.on('call:confirmed', () => {
|
|
519
|
-
checkTransceivers();
|
|
520
|
-
});
|
|
521
|
-
```
|
|
522
|
-
|
|
523
|
-
---
|
|
524
|
-
|
|
525
429
|
## 📡 События и их обработка
|
|
526
430
|
|
|
527
431
|
### Архитектура событий
|
|
@@ -924,7 +828,6 @@ import {
|
|
|
924
828
|
SipConnector, // Низкоуровневый API
|
|
925
829
|
SipConnectorFacade, // Высокоуровневый фасад
|
|
926
830
|
StatsPeerConnection, // Сбор статистики
|
|
927
|
-
TransceiverManager, // Управление transceiver'ами
|
|
928
831
|
// ... другие экспорты
|
|
929
832
|
} from 'sip-connector';
|
|
930
833
|
```
|
|
@@ -941,10 +844,6 @@ await facade.replaceMediaStream(mediaStream, options);
|
|
|
941
844
|
// Получение удаленных потоков
|
|
942
845
|
const streams = facade.getRemoteStreams();
|
|
943
846
|
|
|
944
|
-
// Управление transceiver'ами (низкоуровневый API)
|
|
945
|
-
const transceivers = sipConnector.callManager.getTransceivers();
|
|
946
|
-
await sipConnector.callManager.addTransceiver('video', { direction: 'sendrecv' });
|
|
947
|
-
|
|
948
847
|
// Перезапуск ICE-соединения (низкоуровневый API)
|
|
949
848
|
await sipConnector.callManager.restartIce(options);
|
|
950
849
|
```
|