webrtc.pas 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929
  1. Unit webrtc;
  2. {$MODE ObjFPC}
  3. {$H+}
  4. {$modeswitch externalclass}
  5. interface
  6. uses SysUtils, JS,web;
  7. {
  8. Automatically generated file by TWebIDLToPas on 2020-03-23 14:48:13
  9. Used command-line options :
  10. -x
  11. web
  12. -i
  13. /home/michael/webrtc.idl
  14. -d
  15. TJSObject
  16. -t
  17. DOMTimeStamp=String,Mediastream=TJSHTMLMediaStream,DOMHighResTimeStamp=double,MediaStreamTrack=JSValue,RTCStatsType=String,EventTarget=TJSEventTarget,EventHandler=TJSEventHandler,Promise=TJSPromise,VoidFunction=TProcedure,Event=TJSEvent,Blob=TJSBlob,ArrayBufferView=TJSTypedArray
  18. -p
  19. Command-line options translate to:
  20. Options : [coDictionaryAsClass,coaddOptionsToheader]
  21. Keyword prefix :
  22. Keyword suffix : _
  23. Class prefix : TJS
  24. Class suffix :
  25. Field prefix : F
  26. WEBIDLversion : v2
  27. Type aliases:
  28. DOMTimeStamp=String
  29. Mediastream=TJSHTMLMediaStream
  30. DOMHighResTimeStamp=double
  31. MediaStreamTrack=JSValue
  32. RTCStatsType=String
  33. EventTarget=TJSEventTarget
  34. EventHandler=TJSEventHandler
  35. Promise=TJSPromise
  36. VoidFunction=TProcedure
  37. Event=TJSEvent
  38. Blob=TJSBlob
  39. ArrayBufferView=TJSTypedArray
  40. }
  41. Type
  42. // Forward class definitions
  43. TJSRTCPeerConnection = Class;
  44. TJSRTCSessionDescription = Class;
  45. TJSRTCIceCandidate = Class;
  46. TJSRTCPeerConnectionIceEvent = Class;
  47. TJSRTCPeerConnectionIceErrorEvent = Class;
  48. TJSRTCCertificate = Class;
  49. TJSRTCRtpSender = Class;
  50. TJSRTCRtpReceiver = Class;
  51. TJSRTCRtpTransceiver = Class;
  52. TJSRTCDtlsTransport = Class;
  53. TJSRTCIceTransport = Class;
  54. TJSRTCTrackEvent = Class;
  55. TJSRTCSctpTransport = Class;
  56. TJSRTCDataChannel = Class;
  57. TJSRTCDataChannelEvent = Class;
  58. TJSRTCDTMFSender = Class;
  59. TJSRTCDTMFToneChangeEvent = Class;
  60. TJSRTCStatsReport = Class;
  61. TJSRTCError = Class;
  62. TJSRTCErrorEvent = Class;
  63. TJSRTCConfiguration = Class;
  64. TJSRTCIceServer = Class;
  65. TJSRTCOfferAnswerOptions = Class;
  66. TJSRTCOfferOptions = Class;
  67. TJSRTCAnswerOptions = Class;
  68. TJSRTCSessionDescriptionInit = Class;
  69. TJSRTCIceCandidateInit = Class;
  70. TJSRTCPeerConnectionIceEventInit = Class;
  71. TJSRTCPeerConnectionIceErrorEventInit = Class;
  72. TJSRTCCertificateExpiration = Class;
  73. TJSRTCRtpTransceiverInit = Class;
  74. TJSRTCRtpParameters = Class;
  75. TJSRTCRtpSendParameters = Class;
  76. TJSRTCRtpReceiveParameters = Class;
  77. TJSRTCRtpCodingParameters = Class;
  78. TJSRTCRtpDecodingParameters = Class;
  79. TJSRTCRtpEncodingParameters = Class;
  80. TJSRTCRtcpParameters = Class;
  81. TJSRTCRtpHeaderExtensionParameters = Class;
  82. TJSRTCRtpCodecParameters = Class;
  83. TJSRTCRtpCapabilities = Class;
  84. TJSRTCRtpCodecCapability = Class;
  85. TJSRTCRtpHeaderExtensionCapability = Class;
  86. TJSRTCRtpContributingSource = Class;
  87. TJSRTCRtpSynchronizationSource = Class;
  88. TJSRTCDtlsFingerprint = Class;
  89. TJSRTCIceParameters = Class;
  90. TJSRTCIceCandidatePair = Class;
  91. TJSRTCTrackEventInit = Class;
  92. TJSRTCDataChannelInit = Class;
  93. TJSRTCDataChannelEventInit = Class;
  94. TJSRTCDTMFToneChangeEventInit = Class;
  95. TJSRTCStats = Class;
  96. TJSRTCErrorInit = Class;
  97. TJSRTCErrorEventInit = Class;
  98. RTCIceCredentialType = String;
  99. RTCIceTransportPolicy = String;
  100. RTCBundlePolicy = String;
  101. RTCRtcpMuxPolicy = String;
  102. RTCSignalingState = String;
  103. RTCIceGatheringState = String;
  104. RTCPeerConnectionState = String;
  105. RTCIceConnectionState = String;
  106. RTCSdpType = String;
  107. RTCIceProtocol = String;
  108. RTCIceTcpCandidateType = String;
  109. RTCIceCandidateType = String;
  110. RTCRtpTransceiverDirection = String;
  111. RTCDegradationPreference = String;
  112. RTCDtlsTransportState = String;
  113. RTCIceGathererState = String;
  114. RTCIceTransportState = String;
  115. RTCIceRole = String;
  116. RTCIceComponent = String;
  117. RTCSctpTransportState = String;
  118. RTCDataChannelState = String;
  119. RTCErrorDetailType = String;
  120. RTCPeerConnectionErrorCallback = Procedure (error : TJSError);
  121. RTCSessionDescriptionCallback = Procedure (description : TJSRTCSessionDescriptionInit);
  122. { --------------------------------------------------------------------
  123. TJSRTCConfiguration
  124. --------------------------------------------------------------------}
  125. TTJSRTCIceServerDynArray = Array of TJSRTCIceServer;
  126. TTJSRTCCertificateDynArray = Array of TJSRTCCertificate;
  127. TJSRTCConfiguration = class(TJSObject)
  128. iceServers : TTJSRTCIceServerDynArray;
  129. iceTransportPolicy : RTCIceTransportPolicy;
  130. bundlePolicy : RTCBundlePolicy;
  131. rtcpMuxPolicy : RTCRtcpMuxPolicy;
  132. peerIdentity : String;
  133. certificates : TTJSRTCCertificateDynArray;
  134. iceCandidatePoolSize : Byte;
  135. end;
  136. { --------------------------------------------------------------------
  137. TJSRTCIceServer
  138. --------------------------------------------------------------------}
  139. TJSRTCIceServer = class(TJSObject)
  140. urls : JSValue;
  141. username : String;
  142. credentialType : RTCIceCredentialType;
  143. end;
  144. { --------------------------------------------------------------------
  145. TJSRTCOfferAnswerOptions
  146. --------------------------------------------------------------------}
  147. TJSRTCOfferAnswerOptions = class(TJSObject)
  148. end;
  149. { --------------------------------------------------------------------
  150. TJSRTCOfferOptions
  151. --------------------------------------------------------------------}
  152. TJSRTCOfferOptions = class(TJSObject)
  153. iceRestart : boolean;
  154. offerToReceiveAudio : boolean;
  155. offerToReceiveVideo : boolean;
  156. end;
  157. { --------------------------------------------------------------------
  158. TJSRTCAnswerOptions
  159. --------------------------------------------------------------------}
  160. TJSRTCAnswerOptions = class(TJSObject)
  161. end;
  162. { --------------------------------------------------------------------
  163. TJSRTCSessionDescriptionInit
  164. --------------------------------------------------------------------}
  165. TJSRTCSessionDescriptionInit = class(TJSObject)
  166. type_ : RTCSdpType;external name 'type';
  167. sdp : String;
  168. end;
  169. { --------------------------------------------------------------------
  170. TJSRTCIceCandidateInit
  171. --------------------------------------------------------------------}
  172. TJSRTCIceCandidateInit = class(TJSObject)
  173. candidate : String;
  174. sdpMid : String;
  175. sdpMLineIndex : Cardinal;
  176. usernameFragment : String;
  177. end;
  178. { --------------------------------------------------------------------
  179. TJSRTCPeerConnectionIceEventInit
  180. --------------------------------------------------------------------}
  181. TJSRTCPeerConnectionIceEventInit = class(TJSObject)
  182. candidate : TJSRTCIceCandidate;
  183. url : String;
  184. end;
  185. { --------------------------------------------------------------------
  186. TJSRTCPeerConnectionIceErrorEventInit
  187. --------------------------------------------------------------------}
  188. TJSRTCPeerConnectionIceErrorEventInit = class(TJSObject)
  189. hostCandidate : String;
  190. url : String;
  191. errorCode : Cardinal;
  192. statusText : String;
  193. end;
  194. { --------------------------------------------------------------------
  195. TJSRTCCertificateExpiration
  196. --------------------------------------------------------------------}
  197. TJSRTCCertificateExpiration = class(TJSObject)
  198. expires : String;
  199. end;
  200. { --------------------------------------------------------------------
  201. TJSRTCRtpTransceiverInit
  202. --------------------------------------------------------------------}
  203. TTJSHTMLMediaStreamDynArray = Array of TJSHTMLMediaStream;
  204. TTJSRTCRtpEncodingParametersDynArray = Array of TJSRTCRtpEncodingParameters;
  205. TJSRTCRtpTransceiverInit = class(TJSObject)
  206. direction : RTCRtpTransceiverDirection;
  207. streams : TTJSHTMLMediaStreamDynArray;
  208. sendEncodings : TTJSRTCRtpEncodingParametersDynArray;
  209. end;
  210. { --------------------------------------------------------------------
  211. TJSRTCRtpParameters
  212. --------------------------------------------------------------------}
  213. TTJSRTCRtpHeaderExtensionParametersDynArray = Array of TJSRTCRtpHeaderExtensionParameters;
  214. TTJSRTCRtpCodecParametersDynArray = Array of TJSRTCRtpCodecParameters;
  215. TJSRTCRtpParameters = class(TJSObject)
  216. headerExtensions : TTJSRTCRtpHeaderExtensionParametersDynArray;
  217. rtcp : TJSRTCRtcpParameters;
  218. codecs : TTJSRTCRtpCodecParametersDynArray;
  219. end;
  220. { --------------------------------------------------------------------
  221. TJSRTCRtpSendParameters
  222. --------------------------------------------------------------------}
  223. TJSRTCRtpSendParameters = class(TJSObject)
  224. transactionId : String;
  225. encodings : TTJSRTCRtpEncodingParametersDynArray;
  226. degradationPreference : RTCDegradationPreference;
  227. end;
  228. { --------------------------------------------------------------------
  229. TJSRTCRtpReceiveParameters
  230. --------------------------------------------------------------------}
  231. TTJSRTCRtpDecodingParametersDynArray = Array of TJSRTCRtpDecodingParameters;
  232. TJSRTCRtpReceiveParameters = class(TJSObject)
  233. encodings : TTJSRTCRtpDecodingParametersDynArray;
  234. end;
  235. { --------------------------------------------------------------------
  236. TJSRTCRtpCodingParameters
  237. --------------------------------------------------------------------}
  238. TJSRTCRtpCodingParameters = class(TJSObject)
  239. rid : String;
  240. end;
  241. { --------------------------------------------------------------------
  242. TJSRTCRtpDecodingParameters
  243. --------------------------------------------------------------------}
  244. TJSRTCRtpDecodingParameters = class(TJSObject)
  245. end;
  246. { --------------------------------------------------------------------
  247. TJSRTCRtpEncodingParameters
  248. --------------------------------------------------------------------}
  249. TJSRTCRtpEncodingParameters = class(TJSObject)
  250. active : boolean;
  251. maxBitrate : NativeInt;
  252. scaleResolutionDownBy : Double;
  253. end;
  254. { --------------------------------------------------------------------
  255. TJSRTCRtcpParameters
  256. --------------------------------------------------------------------}
  257. TJSRTCRtcpParameters = class(TJSObject)
  258. cname : String;
  259. reducedSize : boolean;
  260. end;
  261. { --------------------------------------------------------------------
  262. TJSRTCRtpHeaderExtensionParameters
  263. --------------------------------------------------------------------}
  264. TJSRTCRtpHeaderExtensionParameters = class(TJSObject)
  265. uri : String;
  266. id : Cardinal;
  267. encrypted : boolean;
  268. end;
  269. { --------------------------------------------------------------------
  270. TJSRTCRtpCodecParameters
  271. --------------------------------------------------------------------}
  272. TJSRTCRtpCodecParameters = class(TJSObject)
  273. payloadType : Byte;
  274. mimeType : String;
  275. clockRate : NativeInt;
  276. channels : Cardinal;
  277. sdpFmtpLine : String;
  278. end;
  279. { --------------------------------------------------------------------
  280. TJSRTCRtpCapabilities
  281. --------------------------------------------------------------------}
  282. TTJSRTCRtpCodecCapabilityDynArray = Array of TJSRTCRtpCodecCapability;
  283. TTJSRTCRtpHeaderExtensionCapabilityDynArray = Array of TJSRTCRtpHeaderExtensionCapability;
  284. TJSRTCRtpCapabilities = class(TJSObject)
  285. codecs : TTJSRTCRtpCodecCapabilityDynArray;
  286. headerExtensions : TTJSRTCRtpHeaderExtensionCapabilityDynArray;
  287. end;
  288. { --------------------------------------------------------------------
  289. TJSRTCRtpCodecCapability
  290. --------------------------------------------------------------------}
  291. TJSRTCRtpCodecCapability = class(TJSObject)
  292. mimeType : String;
  293. clockRate : NativeInt;
  294. channels : Cardinal;
  295. sdpFmtpLine : String;
  296. end;
  297. { --------------------------------------------------------------------
  298. TJSRTCRtpHeaderExtensionCapability
  299. --------------------------------------------------------------------}
  300. TJSRTCRtpHeaderExtensionCapability = class(TJSObject)
  301. uri : String;
  302. end;
  303. { --------------------------------------------------------------------
  304. TJSRTCRtpContributingSource
  305. --------------------------------------------------------------------}
  306. TJSRTCRtpContributingSource = class(TJSObject)
  307. timestamp : double;
  308. source : NativeInt;
  309. audioLevel : Double;
  310. rtpTimestamp : NativeInt;
  311. end;
  312. { --------------------------------------------------------------------
  313. TJSRTCRtpSynchronizationSource
  314. --------------------------------------------------------------------}
  315. TJSRTCRtpSynchronizationSource = class(TJSObject)
  316. voiceActivityFlag : boolean;
  317. end;
  318. { --------------------------------------------------------------------
  319. TJSRTCDtlsFingerprint
  320. --------------------------------------------------------------------}
  321. TJSRTCDtlsFingerprint = class(TJSObject)
  322. algorithm : String;
  323. value : String;
  324. end;
  325. { --------------------------------------------------------------------
  326. TJSRTCIceParameters
  327. --------------------------------------------------------------------}
  328. TJSRTCIceParameters = class(TJSObject)
  329. usernameFragment : String;
  330. password : String;
  331. end;
  332. { --------------------------------------------------------------------
  333. TJSRTCIceCandidatePair
  334. --------------------------------------------------------------------}
  335. TJSRTCIceCandidatePair = class(TJSObject)
  336. local : TJSRTCIceCandidate;
  337. remote : TJSRTCIceCandidate;
  338. end;
  339. { --------------------------------------------------------------------
  340. TJSRTCTrackEventInit
  341. --------------------------------------------------------------------}
  342. TJSRTCTrackEventInit = class(TJSObject)
  343. receiver : TJSRTCRtpReceiver;
  344. track : JSValue;
  345. streams : TTJSHTMLMediaStreamDynArray;
  346. transceiver : TJSRTCRtpTransceiver;
  347. end;
  348. { --------------------------------------------------------------------
  349. TJSRTCDataChannelInit
  350. --------------------------------------------------------------------}
  351. TJSRTCDataChannelInit = class(TJSObject)
  352. ordered : boolean;
  353. maxPacketLifeTime : Cardinal;
  354. maxRetransmits : Cardinal;
  355. protocol : String;
  356. negotiated : boolean;
  357. id : Cardinal;
  358. end;
  359. { --------------------------------------------------------------------
  360. TJSRTCDataChannelEventInit
  361. --------------------------------------------------------------------}
  362. TJSRTCDataChannelEventInit = class(TJSObject)
  363. channel : TJSRTCDataChannel;
  364. end;
  365. { --------------------------------------------------------------------
  366. TJSRTCDTMFToneChangeEventInit
  367. --------------------------------------------------------------------}
  368. TJSRTCDTMFToneChangeEventInit = class(TJSObject)
  369. tone : String;
  370. end;
  371. { --------------------------------------------------------------------
  372. TJSRTCStats
  373. --------------------------------------------------------------------}
  374. TJSRTCStats = class(TJSObject)
  375. timestamp : double;
  376. type_ : String;external name 'type';
  377. id : String;
  378. end;
  379. { --------------------------------------------------------------------
  380. TJSRTCErrorInit
  381. --------------------------------------------------------------------}
  382. TJSRTCErrorInit = class(TJSObject)
  383. errorDetail : RTCErrorDetailType;
  384. sdpLineNumber : Integer;
  385. httpRequestStatusCode : Integer;
  386. sctpCauseCode : Integer;
  387. receivedAlert : NativeInt;
  388. sentAlert : NativeInt;
  389. end;
  390. { --------------------------------------------------------------------
  391. TJSRTCErrorEventInit
  392. --------------------------------------------------------------------}
  393. TJSRTCErrorEventInit = class(TJSObject)
  394. error : TJSRTCError;
  395. end;
  396. { --------------------------------------------------------------------
  397. TJSRTCPeerConnection
  398. --------------------------------------------------------------------}
  399. TTJSRTCRtpSenderDynArray = Array of TJSRTCRtpSender;
  400. TTJSRTCRtpReceiverDynArray = Array of TJSRTCRtpReceiver;
  401. TTJSRTCRtpTransceiverDynArray = Array of TJSRTCRtpTransceiver;
  402. TJSRTCPeerConnection = class external name 'RTCPeerConnection' (TJSEventTarget)
  403. Private
  404. FlocalDescription : TJSRTCSessionDescription; external name 'localDescription';
  405. FcurrentLocalDescription : TJSRTCSessionDescription; external name 'currentLocalDescription';
  406. FpendingLocalDescription : TJSRTCSessionDescription; external name 'pendingLocalDescription';
  407. FremoteDescription : TJSRTCSessionDescription; external name 'remoteDescription';
  408. FcurrentRemoteDescription : TJSRTCSessionDescription; external name 'currentRemoteDescription';
  409. FpendingRemoteDescription : TJSRTCSessionDescription; external name 'pendingRemoteDescription';
  410. FsignalingState : RTCSignalingState; external name 'signalingState';
  411. FiceGatheringState : RTCIceGatheringState; external name 'iceGatheringState';
  412. FiceConnectionState : RTCIceConnectionState; external name 'iceConnectionState';
  413. FconnectionState : RTCPeerConnectionState; external name 'connectionState';
  414. FcanTrickleIceCandidates : boolean; external name 'canTrickleIceCandidates';
  415. Fsctp : TJSRTCSctpTransport; external name 'sctp';
  416. Public
  417. onnegotiationneeded : TJSEventHandler;
  418. onicecandidate : TJSEventHandler;
  419. onicecandidateerror : TJSEventHandler;
  420. onsignalingstatechange : TJSEventHandler;
  421. oniceconnectionstatechange : TJSEventHandler;
  422. onicegatheringstatechange : TJSEventHandler;
  423. onconnectionstatechange : TJSEventHandler;
  424. ontrack : TJSEventHandler;
  425. ondatachannel : TJSEventHandler;
  426. constructor New(configuration : TJSRTCConfiguration); overload;
  427. constructor New; overload;
  428. function createOffer(options : TJSRTCOfferOptions): TJSPromise; overload;
  429. function createOffer: TJSPromise; overload;
  430. function createAnswer(options : TJSRTCAnswerOptions): TJSPromise; overload;
  431. function createAnswer: TJSPromise; overload;
  432. function setLocalDescription(description : TJSRTCSessionDescriptionInit): TJSPromise; overload;
  433. function setLocalDescription: TJSPromise; overload;
  434. function setRemoteDescription(description : TJSRTCSessionDescriptionInit): TJSPromise; overload;
  435. function setRemoteDescription: TJSPromise; overload;
  436. function addIceCandidate(candidate : TJSRTCIceCandidateInit): TJSPromise; overload;
  437. function addIceCandidate: TJSPromise; overload;
  438. Procedure restartIce;
  439. function getConfiguration: TJSRTCConfiguration;
  440. Procedure setConfiguration(configuration : TJSRTCConfiguration);
  441. Procedure close;
  442. function createOffer(successCallback : RTCSessionDescriptionCallback; failureCallback : RTCPeerConnectionErrorCallback; options : TJSRTCOfferOptions): TJSPromise; overload;
  443. function createOffer(successCallback : RTCSessionDescriptionCallback; failureCallback : RTCPeerConnectionErrorCallback): TJSPromise; overload;
  444. function createAnswer(successCallback : RTCSessionDescriptionCallback; failureCallback : RTCPeerConnectionErrorCallback): TJSPromise;
  445. function addIceCandidate(candidate : TJSRTCIceCandidateInit; successCallback : TProcedure; failureCallback : RTCPeerConnectionErrorCallback): TJSPromise;
  446. function generateCertificate(keygenAlgorithm : AlgorithmIdentifier): TJSPromise;
  447. function getSenders: TTJSRTCRtpSenderDynArray;
  448. function getReceivers: TTJSRTCRtpReceiverDynArray;
  449. function getTransceivers: TTJSRTCRtpTransceiverDynArray;
  450. function addTrack(track : JSValue; streams : TJSHTMLMediaStream): TJSRTCRtpSender; varargs;
  451. Procedure removeTrack(sender : TJSRTCRtpSender);
  452. function addTransceiver(trackOrKind : JSValue; init : TJSRTCRtpTransceiverInit): TJSRTCRtpTransceiver; overload;
  453. function addTransceiver(trackOrKind : JSValue): TJSRTCRtpTransceiver; overload;
  454. function createDataChannel(label_ : String; dataChannelDict : TJSRTCDataChannelInit): TJSRTCDataChannel; overload;
  455. function createDataChannel(label_ : String): TJSRTCDataChannel; overload;
  456. function getStats(selector : JSValue): TJSPromise; overload;
  457. function getStats: TJSPromise; overload;
  458. Property localDescription : TJSRTCSessionDescription Read FlocalDescription;
  459. Property currentLocalDescription : TJSRTCSessionDescription Read FcurrentLocalDescription;
  460. Property pendingLocalDescription : TJSRTCSessionDescription Read FpendingLocalDescription;
  461. Property remoteDescription : TJSRTCSessionDescription Read FremoteDescription;
  462. Property currentRemoteDescription : TJSRTCSessionDescription Read FcurrentRemoteDescription;
  463. Property pendingRemoteDescription : TJSRTCSessionDescription Read FpendingRemoteDescription;
  464. Property signalingState : RTCSignalingState Read FsignalingState;
  465. Property iceGatheringState : RTCIceGatheringState Read FiceGatheringState;
  466. Property iceConnectionState : RTCIceConnectionState Read FiceConnectionState;
  467. Property connectionState : RTCPeerConnectionState Read FconnectionState;
  468. Property canTrickleIceCandidates : boolean Read FcanTrickleIceCandidates;
  469. Property sctp : TJSRTCSctpTransport Read Fsctp;
  470. end;
  471. { --------------------------------------------------------------------
  472. TJSRTCSessionDescription
  473. --------------------------------------------------------------------}
  474. TJSRTCSessionDescription = class external name 'RTCSessionDescription'
  475. Private
  476. Ftype_ : RTCSdpType; external name 'type';
  477. Fsdp : String; external name 'sdp';
  478. Public
  479. constructor New(descriptionInitDict : TJSRTCSessionDescriptionInit); overload;
  480. constructor New; overload;
  481. function toJSON: TJSObject;
  482. Property type_ : RTCSdpType Read Ftype_;
  483. Property sdp : String Read Fsdp;
  484. end;
  485. { --------------------------------------------------------------------
  486. TJSRTCIceCandidate
  487. --------------------------------------------------------------------}
  488. TJSRTCIceCandidate = class external name 'RTCIceCandidate'
  489. Private
  490. Fcandidate : String; external name 'candidate';
  491. FsdpMid : String; external name 'sdpMid';
  492. FsdpMLineIndex : Cardinal; external name 'sdpMLineIndex';
  493. Ffoundation : String; external name 'foundation';
  494. Fcomponent : RTCIceComponent; external name 'component';
  495. Fpriority : NativeInt; external name 'priority';
  496. Faddress : String; external name 'address';
  497. Fprotocol : RTCIceProtocol; external name 'protocol';
  498. Fport : Cardinal; external name 'port';
  499. Ftype_ : RTCIceCandidateType; external name 'type';
  500. FtcpType : RTCIceTcpCandidateType; external name 'tcpType';
  501. FrelatedAddress : String; external name 'relatedAddress';
  502. FrelatedPort : Cardinal; external name 'relatedPort';
  503. FusernameFragment : String; external name 'usernameFragment';
  504. Public
  505. constructor New(candidateInitDict : TJSRTCIceCandidateInit); overload;
  506. constructor New; overload;
  507. function toJSON: TJSRTCIceCandidateInit;
  508. Property candidate : String Read Fcandidate;
  509. Property sdpMid : String Read FsdpMid;
  510. Property sdpMLineIndex : Cardinal Read FsdpMLineIndex;
  511. Property foundation : String Read Ffoundation;
  512. Property component : RTCIceComponent Read Fcomponent;
  513. Property priority : NativeInt Read Fpriority;
  514. Property address : String Read Faddress;
  515. Property protocol : RTCIceProtocol Read Fprotocol;
  516. Property port : Cardinal Read Fport;
  517. Property type_ : RTCIceCandidateType Read Ftype_;
  518. Property tcpType : RTCIceTcpCandidateType Read FtcpType;
  519. Property relatedAddress : String Read FrelatedAddress;
  520. Property relatedPort : Cardinal Read FrelatedPort;
  521. Property usernameFragment : String Read FusernameFragment;
  522. end;
  523. { --------------------------------------------------------------------
  524. TJSRTCPeerConnectionIceEvent
  525. --------------------------------------------------------------------}
  526. TJSRTCPeerConnectionIceEvent = class external name 'RTCPeerConnectionIceEvent' (TJSEvent)
  527. Private
  528. Fcandidate : TJSRTCIceCandidate; external name 'candidate';
  529. Furl : String; external name 'url';
  530. Public
  531. constructor New(type_ : String; eventInitDict : TJSRTCPeerConnectionIceEventInit); overload;
  532. constructor New(type_ : String); overload;
  533. Property candidate : TJSRTCIceCandidate Read Fcandidate;
  534. Property url : String Read Furl;
  535. end;
  536. { --------------------------------------------------------------------
  537. TJSRTCPeerConnectionIceErrorEvent
  538. --------------------------------------------------------------------}
  539. TJSRTCPeerConnectionIceErrorEvent = class external name 'RTCPeerConnectionIceErrorEvent' (TJSEvent)
  540. Private
  541. Faddress : String; external name 'address';
  542. Fport : Cardinal; external name 'port';
  543. Furl : String; external name 'url';
  544. FerrorCode : Cardinal; external name 'errorCode';
  545. FerrorText : String; external name 'errorText';
  546. Public
  547. constructor New(type_ : String; eventInitDict : TJSRTCPeerConnectionIceErrorEventInit);
  548. Property address : String Read Faddress;
  549. Property port : Cardinal Read Fport;
  550. Property url : String Read Furl;
  551. Property errorCode : Cardinal Read FerrorCode;
  552. Property errorText : String Read FerrorText;
  553. end;
  554. { --------------------------------------------------------------------
  555. TJSRTCCertificate
  556. --------------------------------------------------------------------}
  557. TTJSRTCDtlsFingerprintDynArray = Array of TJSRTCDtlsFingerprint;
  558. TJSRTCCertificate = class external name 'RTCCertificate'
  559. Private
  560. Fexpires : String; external name 'expires';
  561. Public
  562. function getFingerprints: TTJSRTCDtlsFingerprintDynArray;
  563. Property expires : String Read Fexpires;
  564. end;
  565. { --------------------------------------------------------------------
  566. TJSRTCRtpSender
  567. --------------------------------------------------------------------}
  568. TJSRTCRtpSender = class external name 'RTCRtpSender'
  569. Private
  570. Ftrack : JSValue; external name 'track';
  571. Ftransport : TJSRTCDtlsTransport; external name 'transport';
  572. Fdtmf : TJSRTCDTMFSender; external name 'dtmf';
  573. Public
  574. function getCapabilities(kind : String): TJSRTCRtpCapabilities;
  575. function setParameters(parameters : TJSRTCRtpSendParameters): TJSPromise;
  576. function getParameters: TJSRTCRtpSendParameters;
  577. function replaceTrack(withTrack : JSValue): TJSPromise;
  578. Procedure setStreams(streams : TJSHTMLMediaStream); varargs;
  579. function getStats: TJSPromise;
  580. Property track : JSValue Read Ftrack;
  581. Property transport : TJSRTCDtlsTransport Read Ftransport;
  582. Property dtmf : TJSRTCDTMFSender Read Fdtmf;
  583. end;
  584. { --------------------------------------------------------------------
  585. TJSRTCRtpReceiver
  586. --------------------------------------------------------------------}
  587. TTJSRTCRtpContributingSourceDynArray = Array of TJSRTCRtpContributingSource;
  588. TTJSRTCRtpSynchronizationSourceDynArray = Array of TJSRTCRtpSynchronizationSource;
  589. TJSRTCRtpReceiver = class external name 'RTCRtpReceiver'
  590. Private
  591. Ftrack : JSValue; external name 'track';
  592. Ftransport : TJSRTCDtlsTransport; external name 'transport';
  593. Public
  594. function getCapabilities(kind : String): TJSRTCRtpCapabilities;
  595. function getParameters: TJSRTCRtpReceiveParameters;
  596. function getContributingSources: TTJSRTCRtpContributingSourceDynArray;
  597. function getSynchronizationSources: TTJSRTCRtpSynchronizationSourceDynArray;
  598. function getStats: TJSPromise;
  599. Property track : JSValue Read Ftrack;
  600. Property transport : TJSRTCDtlsTransport Read Ftransport;
  601. end;
  602. { --------------------------------------------------------------------
  603. TJSRTCRtpTransceiver
  604. --------------------------------------------------------------------}
  605. TJSRTCRtpTransceiver = class external name 'RTCRtpTransceiver'
  606. Private
  607. Fmid : String; external name 'mid';
  608. Fsender : TJSRTCRtpSender; external name 'sender';
  609. Freceiver : TJSRTCRtpReceiver; external name 'receiver';
  610. FcurrentDirection : RTCRtpTransceiverDirection; external name 'currentDirection';
  611. Public
  612. direction : RTCRtpTransceiverDirection;
  613. Procedure stop;
  614. Procedure setCodecPreferences(codecs : TTJSRTCRtpCodecCapabilityDynArray);
  615. Property mid : String Read Fmid;
  616. Property sender : TJSRTCRtpSender Read Fsender;
  617. Property receiver : TJSRTCRtpReceiver Read Freceiver;
  618. Property currentDirection : RTCRtpTransceiverDirection Read FcurrentDirection;
  619. end;
  620. { --------------------------------------------------------------------
  621. TJSRTCDtlsTransport
  622. --------------------------------------------------------------------}
  623. TTJSArrayBufferDynArray = Array of TJSArrayBuffer;
  624. TJSRTCDtlsTransport = class external name 'RTCDtlsTransport' (TJSEventTarget)
  625. Private
  626. FiceTransport : TJSRTCIceTransport; external name 'iceTransport';
  627. Fstate : RTCDtlsTransportState; external name 'state';
  628. Public
  629. onstatechange : TJSEventHandler;
  630. onerror : TJSEventHandler;
  631. function getRemoteCertificates: TTJSArrayBufferDynArray;
  632. Property iceTransport : TJSRTCIceTransport Read FiceTransport;
  633. Property state : RTCDtlsTransportState Read Fstate;
  634. end;
  635. { --------------------------------------------------------------------
  636. TJSRTCIceTransport
  637. --------------------------------------------------------------------}
  638. TTJSRTCIceCandidateDynArray = Array of TJSRTCIceCandidate;
  639. TJSRTCIceTransport = class external name 'RTCIceTransport' (TJSEventTarget)
  640. Private
  641. Frole : RTCIceRole; external name 'role';
  642. Fcomponent : RTCIceComponent; external name 'component';
  643. Fstate : RTCIceTransportState; external name 'state';
  644. FgatheringState : RTCIceGathererState; external name 'gatheringState';
  645. Public
  646. onstatechange : TJSEventHandler;
  647. ongatheringstatechange : TJSEventHandler;
  648. onselectedcandidatepairchange : TJSEventHandler;
  649. function getLocalCandidates: TTJSRTCIceCandidateDynArray;
  650. function getRemoteCandidates: TTJSRTCIceCandidateDynArray;
  651. function getSelectedCandidatePair: TJSRTCIceCandidatePair;
  652. function getLocalParameters: TJSRTCIceParameters;
  653. function getRemoteParameters: TJSRTCIceParameters;
  654. Property role : RTCIceRole Read Frole;
  655. Property component : RTCIceComponent Read Fcomponent;
  656. Property state : RTCIceTransportState Read Fstate;
  657. Property gatheringState : RTCIceGathererState Read FgatheringState;
  658. end;
  659. { --------------------------------------------------------------------
  660. TJSRTCTrackEvent
  661. --------------------------------------------------------------------}
  662. TJSRTCTrackEvent = class external name 'RTCTrackEvent' (TJSEvent)
  663. Private
  664. Freceiver : TJSRTCRtpReceiver; external name 'receiver';
  665. Ftrack : JSValue; external name 'track';
  666. Fstreams : TTJSHTMLMediaStreamDynArray; external name 'streams';
  667. Ftransceiver : TJSRTCRtpTransceiver; external name 'transceiver';
  668. Public
  669. constructor New(type_ : String; eventInitDict : TJSRTCTrackEventInit);
  670. Property receiver : TJSRTCRtpReceiver Read Freceiver;
  671. Property track : JSValue Read Ftrack;
  672. Property streams : TTJSHTMLMediaStreamDynArray Read Fstreams;
  673. Property transceiver : TJSRTCRtpTransceiver Read Ftransceiver;
  674. end;
  675. { --------------------------------------------------------------------
  676. TJSRTCSctpTransport
  677. --------------------------------------------------------------------}
  678. TJSRTCSctpTransport = class external name 'RTCSctpTransport' (TJSEventTarget)
  679. Private
  680. Ftransport : TJSRTCDtlsTransport; external name 'transport';
  681. Fstate : RTCSctpTransportState; external name 'state';
  682. FmaxMessageSize : Double; external name 'maxMessageSize';
  683. FmaxChannels : Cardinal; external name 'maxChannels';
  684. Public
  685. onstatechange : TJSEventHandler;
  686. Property transport : TJSRTCDtlsTransport Read Ftransport;
  687. Property state : RTCSctpTransportState Read Fstate;
  688. Property maxMessageSize : Double Read FmaxMessageSize;
  689. Property maxChannels : Cardinal Read FmaxChannels;
  690. end;
  691. { --------------------------------------------------------------------
  692. TJSRTCDataChannel
  693. --------------------------------------------------------------------}
  694. TJSRTCDataChannel = class external name 'RTCDataChannel' (TJSEventTarget)
  695. Private
  696. Flabel_ : String; external name 'label';
  697. Fordered : boolean; external name 'ordered';
  698. FmaxPacketLifeTime : Cardinal; external name 'maxPacketLifeTime';
  699. FmaxRetransmits : Cardinal; external name 'maxRetransmits';
  700. Fprotocol : String; external name 'protocol';
  701. Fnegotiated : boolean; external name 'negotiated';
  702. Fid : Cardinal; external name 'id';
  703. FreadyState : RTCDataChannelState; external name 'readyState';
  704. FbufferedAmount : NativeInt; external name 'bufferedAmount';
  705. Public
  706. bufferedAmountLowThreshold : NativeInt;
  707. onopen : TJSEventHandler;
  708. onbufferedamountlow : TJSEventHandler;
  709. onerror : TJSEventHandler;
  710. onclosing : TJSEventHandler;
  711. onclose : TJSEventHandler;
  712. onmessage : TJSEventHandler;
  713. binaryType : String;
  714. Procedure close;
  715. Procedure send(data : String);
  716. Procedure send(data : TJSBlob);
  717. Procedure send(data : TJSArrayBuffer);
  718. Procedure send(data : TJSTypedArray);
  719. Property label_ : String Read Flabel_;
  720. Property ordered : boolean Read Fordered;
  721. Property maxPacketLifeTime : Cardinal Read FmaxPacketLifeTime;
  722. Property maxRetransmits : Cardinal Read FmaxRetransmits;
  723. Property protocol : String Read Fprotocol;
  724. Property negotiated : boolean Read Fnegotiated;
  725. Property id : Cardinal Read Fid;
  726. Property readyState : RTCDataChannelState Read FreadyState;
  727. Property bufferedAmount : NativeInt Read FbufferedAmount;
  728. end;
  729. { --------------------------------------------------------------------
  730. TJSRTCDataChannelEvent
  731. --------------------------------------------------------------------}
  732. TJSRTCDataChannelEvent = class external name 'RTCDataChannelEvent' (TJSEvent)
  733. Private
  734. Fchannel : TJSRTCDataChannel; external name 'channel';
  735. Public
  736. constructor New(type_ : String; eventInitDict : TJSRTCDataChannelEventInit);
  737. Property channel : TJSRTCDataChannel Read Fchannel;
  738. end;
  739. { --------------------------------------------------------------------
  740. TJSRTCDTMFSender
  741. --------------------------------------------------------------------}
  742. TJSRTCDTMFSender = class external name 'RTCDTMFSender' (TJSEventTarget)
  743. Private
  744. FcanInsertDTMF : boolean; external name 'canInsertDTMF';
  745. FtoneBuffer : String; external name 'toneBuffer';
  746. Public
  747. ontonechange : TJSEventHandler;
  748. Procedure insertDTMF(tones : String; duration : NativeInt; interToneGap : NativeInt); overload;
  749. Procedure insertDTMF(tones : String); overload;
  750. Procedure insertDTMF(tones : String; duration : NativeInt); overload;
  751. Property canInsertDTMF : boolean Read FcanInsertDTMF;
  752. Property toneBuffer : String Read FtoneBuffer;
  753. end;
  754. { --------------------------------------------------------------------
  755. TJSRTCDTMFToneChangeEvent
  756. --------------------------------------------------------------------}
  757. TJSRTCDTMFToneChangeEvent = class external name 'RTCDTMFToneChangeEvent' (TJSEvent)
  758. Private
  759. Ftone : String; external name 'tone';
  760. Public
  761. constructor New(type_ : String; eventInitDict : TJSRTCDTMFToneChangeEventInit);
  762. Property tone : String Read Ftone;
  763. end;
  764. { --------------------------------------------------------------------
  765. TJSRTCStatsReport
  766. --------------------------------------------------------------------}
  767. TJSRTCStatsReport = class external name 'RTCStatsReport'
  768. Private
  769. Public
  770. end;
  771. { --------------------------------------------------------------------
  772. TJSRTCError
  773. --------------------------------------------------------------------}
  774. TJSRTCError = class external name 'RTCError' (TJSError)
  775. Private
  776. FerrorDetail : RTCErrorDetailType; external name 'errorDetail';
  777. FsdpLineNumber : Integer; external name 'sdpLineNumber';
  778. FhttpRequestStatusCode : Integer; external name 'httpRequestStatusCode';
  779. FsctpCauseCode : Integer; external name 'sctpCauseCode';
  780. FreceivedAlert : NativeInt; external name 'receivedAlert';
  781. FsentAlert : NativeInt; external name 'sentAlert';
  782. Public
  783. constructor New(init : TJSRTCErrorInit; message : String); overload;
  784. constructor New(init : TJSRTCErrorInit); overload;
  785. Property errorDetail : RTCErrorDetailType Read FerrorDetail;
  786. Property sdpLineNumber : Integer Read FsdpLineNumber;
  787. Property httpRequestStatusCode : Integer Read FhttpRequestStatusCode;
  788. Property sctpCauseCode : Integer Read FsctpCauseCode;
  789. Property receivedAlert : NativeInt Read FreceivedAlert;
  790. Property sentAlert : NativeInt Read FsentAlert;
  791. end;
  792. { --------------------------------------------------------------------
  793. TJSRTCErrorEvent
  794. --------------------------------------------------------------------}
  795. TJSRTCErrorEvent = class external name 'RTCErrorEvent' (TJSEvent)
  796. Private
  797. Ferror : TJSRTCError; external name 'error';
  798. Public
  799. constructor New(type_ : String; eventInitDict : TJSRTCErrorEventInit);
  800. Property error : TJSRTCError Read Ferror;
  801. end;
  802. implementation
  803. end.