@@ -9,20 +9,19 @@ import {
9
9
RtpPacket ,
10
10
} from 'werift'
11
11
import { interval , merge , Observable , ReplaySubject , Subject } from 'rxjs'
12
- import { logError , logInfo } from '../util'
12
+ import { logDebug , logError , logInfo } from '../util'
13
13
import { Subscribed } from '../subscribed'
14
14
15
- const debug = false ,
16
- ringIceServers = [
17
- 'stun:stun.kinesisvideo.us-east-1.amazonaws.com:443' ,
18
- 'stun:stun.kinesisvideo.us-east-2.amazonaws.com:443' ,
19
- 'stun:stun.kinesisvideo.us-west-2.amazonaws.com:443' ,
20
- 'stun:stun.l.google.com:19302' ,
21
- 'stun:stun1.l.google.com:19302' ,
22
- 'stun:stun2.l.google.com:19302' ,
23
- 'stun:stun3.l.google.com:19302' ,
24
- 'stun:stun4.l.google.com:19302' ,
25
- ]
15
+ const ringIceServers = [
16
+ 'stun:stun.kinesisvideo.us-east-1.amazonaws.com:443' ,
17
+ 'stun:stun.kinesisvideo.us-east-2.amazonaws.com:443' ,
18
+ 'stun:stun.kinesisvideo.us-west-2.amazonaws.com:443' ,
19
+ 'stun:stun.l.google.com:19302' ,
20
+ 'stun:stun1.l.google.com:19302' ,
21
+ 'stun:stun2.l.google.com:19302' ,
22
+ 'stun:stun3.l.google.com:19302' ,
23
+ 'stun:stun4.l.google.com:19302' ,
24
+ ]
26
25
27
26
export interface BasicPeerConnection {
28
27
createOffer ( ) : Promise < { sdp : string } >
@@ -31,7 +30,7 @@ export interface BasicPeerConnection {
31
30
sdp : string
32
31
} ) : Promise < RTCSessionDescriptionInit >
33
32
acceptAnswer ( answer : { type : 'answer' ; sdp : string } ) : Promise < void >
34
- addIceCandidate ( candidate : RTCIceCandidate ) : Promise < void >
33
+ addIceCandidate ( candidate : Partial < RTCIceCandidate > ) : Promise < void >
35
34
onIceCandidate : Observable < RTCIceCandidate >
36
35
onConnectionState : Observable < ConnectionState >
37
36
close ( ) : void
@@ -87,6 +86,7 @@ export class WeriftPeerConnection
87
86
} ,
88
87
iceServers : ringIceServers . map ( ( server ) => ( { urls : server } ) ) ,
89
88
iceTransportPolicy : 'all' ,
89
+ bundlePolicy : 'disable' ,
90
90
} ) ) ,
91
91
audioTransceiver = pc . addTransceiver ( this . returnAudioTrack , {
92
92
direction : 'sendrecv' ,
@@ -104,11 +104,9 @@ export class WeriftPeerConnection
104
104
this . onAudioRtcp . next ( rtcp )
105
105
} )
106
106
107
- if ( debug ) {
108
- track . onReceiveRtp . once ( ( ) => {
109
- logInfo ( 'received first audio packet' )
110
- } )
111
- }
107
+ track . onReceiveRtp . once ( ( ) => {
108
+ logDebug ( 'received first audio packet' )
109
+ } )
112
110
} )
113
111
114
112
videoTransceiver . onTrack . subscribe ( ( track ) => {
@@ -121,9 +119,7 @@ export class WeriftPeerConnection
121
119
} )
122
120
123
121
track . onReceiveRtp . once ( ( ) => {
124
- if ( debug ) {
125
- logInfo ( 'received first video packet' )
126
- }
122
+ logDebug ( 'received first video packet' )
127
123
128
124
this . addSubscriptions (
129
125
merge ( this . onRequestKeyFrame , interval ( 4000 ) ) . subscribe ( ( ) => {
0 commit comments