@livekit/react-native 2.1.1 → 2.3.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.
Files changed (110) hide show
  1. package/README.md +15 -6
  2. package/android/build.gradle +1 -1
  3. package/android/gradle/wrapper/gradle-wrapper.properties +3 -1
  4. package/android/gradlew +29 -14
  5. package/android/gradlew.bat +19 -16
  6. package/android/src/main/java/com/livekit/reactnative/LiveKitReactNative.kt +14 -1
  7. package/android/src/main/java/com/livekit/reactnative/LivekitReactNativeModule.kt +10 -0
  8. package/android/src/main/java/com/livekit/reactnative/video/SimulcastVideoEncoderFactoryWrapper.kt +2 -2
  9. package/android/src/main/java/org/webrtc/audio/WebRtcAudioTrackHelper.kt +20 -0
  10. package/lib/commonjs/audio/AudioManager.js +4 -27
  11. package/lib/commonjs/audio/AudioManager.js.map +1 -1
  12. package/lib/commonjs/audio/AudioSession.js +55 -23
  13. package/lib/commonjs/audio/AudioSession.js.map +1 -1
  14. package/lib/commonjs/components/LiveKitRoom.js +3 -6
  15. package/lib/commonjs/components/LiveKitRoom.js.map +1 -1
  16. package/lib/commonjs/components/VideoTrack.js +30 -66
  17. package/lib/commonjs/components/VideoTrack.js.map +1 -1
  18. package/lib/commonjs/components/VideoView.js +32 -63
  19. package/lib/commonjs/components/VideoView.js.map +1 -1
  20. package/lib/commonjs/components/ViewPortDetector.js +15 -62
  21. package/lib/commonjs/components/ViewPortDetector.js.map +1 -1
  22. package/lib/commonjs/hooks.js +6 -63
  23. package/lib/commonjs/hooks.js.map +1 -1
  24. package/lib/commonjs/index.js +10 -85
  25. package/lib/commonjs/index.js.map +1 -1
  26. package/lib/commonjs/logger.js +4 -14
  27. package/lib/commonjs/logger.js.map +1 -1
  28. package/lib/commonjs/polyfills/EncoderDecoderTogether.min.js +105 -0
  29. package/lib/commonjs/polyfills/EncoderDecoderTogether.min.js.map +1 -0
  30. package/lib/commonjs/useParticipant.js +5 -13
  31. package/lib/commonjs/useParticipant.js.map +1 -1
  32. package/lib/commonjs/useRoom.js +17 -33
  33. package/lib/commonjs/useRoom.js.map +1 -1
  34. package/lib/module/audio/AudioManager.js +3 -17
  35. package/lib/module/audio/AudioManager.js.map +1 -1
  36. package/lib/module/audio/AudioSession.js +54 -16
  37. package/lib/module/audio/AudioSession.js.map +1 -1
  38. package/lib/module/components/LiveKitRoom.js +1 -0
  39. package/lib/module/components/LiveKitRoom.js.map +1 -1
  40. package/lib/module/components/VideoTrack.js +18 -44
  41. package/lib/module/components/VideoTrack.js.map +1 -1
  42. package/lib/module/components/VideoView.js +18 -42
  43. package/lib/module/components/VideoView.js.map +1 -1
  44. package/lib/module/components/ViewPortDetector.js +13 -54
  45. package/lib/module/components/ViewPortDetector.js.map +1 -1
  46. package/lib/module/hooks.js +1 -2
  47. package/lib/module/hooks.js.map +1 -1
  48. package/lib/module/index.js +6 -24
  49. package/lib/module/index.js.map +1 -1
  50. package/lib/module/logger.js +2 -6
  51. package/lib/module/logger.js.map +1 -1
  52. package/lib/module/polyfills/EncoderDecoderTogether.min.js +105 -0
  53. package/lib/module/polyfills/EncoderDecoderTogether.min.js.map +1 -0
  54. package/lib/module/useParticipant.js +5 -11
  55. package/lib/module/useParticipant.js.map +1 -1
  56. package/lib/module/useRoom.js +17 -30
  57. package/lib/module/useRoom.js.map +1 -1
  58. package/lib/typescript/babel.config.d.ts +1 -0
  59. package/lib/typescript/docs/assets/icons.d.ts +0 -0
  60. package/lib/typescript/docs/assets/main.d.ts +0 -0
  61. package/lib/typescript/docs/assets/navigation.d.ts +0 -0
  62. package/lib/typescript/docs/assets/search.d.ts +0 -0
  63. package/lib/typescript/lib/commonjs/audio/AudioManager.d.ts +10 -0
  64. package/lib/typescript/lib/commonjs/audio/AudioSession.d.ts +33 -0
  65. package/lib/typescript/lib/commonjs/components/LiveKitRoom.d.ts +20 -0
  66. package/lib/typescript/lib/commonjs/components/VideoTrack.d.ts +8 -0
  67. package/lib/typescript/lib/commonjs/components/VideoView.d.ts +14 -0
  68. package/lib/typescript/lib/commonjs/components/ViewPortDetector.d.ts +30 -0
  69. package/lib/typescript/lib/commonjs/hooks.d.ts +29 -0
  70. package/lib/typescript/lib/commonjs/index.d.ts +10 -0
  71. package/lib/typescript/lib/commonjs/logger.d.ts +8 -0
  72. package/lib/typescript/lib/commonjs/useParticipant.d.ts +14 -0
  73. package/lib/typescript/lib/commonjs/useRoom.d.ts +16 -0
  74. package/lib/typescript/lib/module/audio/AudioManager.d.ts +9 -0
  75. package/lib/typescript/lib/module/audio/AudioSession.d.ts +31 -0
  76. package/lib/typescript/lib/module/components/LiveKitRoom.d.ts +22 -0
  77. package/lib/typescript/lib/module/components/VideoTrack.d.ts +9 -0
  78. package/lib/typescript/lib/module/components/VideoView.d.ts +9 -0
  79. package/lib/typescript/lib/module/components/ViewPortDetector.d.ts +29 -0
  80. package/lib/typescript/lib/module/hooks.d.ts +1 -0
  81. package/lib/typescript/lib/module/index.d.ts +18 -0
  82. package/lib/typescript/lib/module/logger.d.ts +8 -0
  83. package/lib/typescript/lib/module/polyfills/EncoderDecoderTogether.min.d.ts +0 -0
  84. package/lib/typescript/lib/module/useParticipant.d.ts +13 -0
  85. package/lib/typescript/lib/module/useRoom.d.ts +15 -0
  86. package/lib/typescript/scripts/bootstrap.d.ts +1 -0
  87. package/lib/typescript/{audio → src/audio}/AudioSession.d.ts +7 -9
  88. package/lib/typescript/{components → src/components}/LiveKitRoom.d.ts +1 -1
  89. package/lib/typescript/{components → src/components}/VideoTrack.d.ts +2 -2
  90. package/lib/typescript/{components → src/components}/VideoView.d.ts +3 -3
  91. package/lib/typescript/{components → src/components}/ViewPortDetector.d.ts +3 -3
  92. package/lib/typescript/src/hooks.d.ts +3 -0
  93. package/lib/typescript/src/index.d.ts +20 -0
  94. package/lib/typescript/{logger.d.ts → src/logger.d.ts} +2 -2
  95. package/lib/typescript/src/polyfills/EncoderDecoderTogether.min.d.ts +0 -0
  96. package/lib/typescript/{useRoom.d.ts → src/useRoom.d.ts} +1 -1
  97. package/package.json +22 -19
  98. package/src/audio/AudioSession.ts +0 -2
  99. package/src/components/LiveKitRoom.tsx +1 -1
  100. package/src/components/VideoTrack.tsx +7 -2
  101. package/src/components/VideoView.tsx +8 -3
  102. package/src/components/ViewPortDetector.tsx +4 -4
  103. package/src/hooks.ts +12 -9
  104. package/src/index.tsx +11 -9
  105. package/src/polyfills/EncoderDecoderTogether.min.js +6 -0
  106. package/src/useRoom.ts +1 -1
  107. package/lib/typescript/hooks.d.ts +0 -2
  108. package/lib/typescript/index.d.ts +0 -19
  109. /package/lib/typescript/{audio → src/audio}/AudioManager.d.ts +0 -0
  110. /package/lib/typescript/{useParticipant.d.ts → src/useParticipant.d.ts} +0 -0
@@ -1 +1 @@
1
- {"version":3,"sources":["useRoom.ts"],"names":["ConnectionState","RoomEvent","Track","useEffect","useState","useRoom","room","options","error","participants","setParticipants","audioTracks","setAudioTracks","sortFunc","sortParticipants","onParticipantsChanged","remotes","Array","from","remoteParticipants","values","newParticipants","localParticipant","push","onSubscribedTrackChanged","track","kind","Kind","Audio","tracks","forEach","p","audioTrackPublications","pub","audioTrack","onConnectionStateChanged","state","Connected","once","Disconnected","off","ParticipantConnected","ParticipantDisconnected","ActiveSpeakersChanged","TrackSubscribed","TrackUnsubscribed","LocalTrackPublished","LocalTrackUnpublished","AudioPlaybackStatusChanged","ConnectionStateChanged","on","Reconnected","disconnect","sort","a","b","isSpeaking","audioLevel","lastSpokeAt","aLast","getTime","bLast","aVideo","videoTrackPublications","size","bVideo","joinedAt","localIdx","indexOf","splice","length"],"mappings":"AAAA,SAEEA,eAFF,EAOEC,SAPF,EAQEC,KARF,QASO,gBATP;AAUA,SAASC,SAAT,EAAoBC,QAApB,QAAoC,OAApC;;AAeA;AACA,OAAO,SAASC,OAAT,CAAiBC,IAAjB,EAA6BC,OAA7B,EAA+D;AAAA;;AACpE,QAAM,CAACC,KAAD,IAAUJ,QAAQ,EAAxB;AACA,QAAM,CAACK,YAAD,EAAeC,eAAf,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AAGV,CAAC,CAACQ,sBAAF,CAAyBC,IAAzB,GAAgC,CAA/C;;AACA,QAAIF,MAAM,KAAKG,MAAf,EAAuB;AACrB,UAAIH,MAAJ,EAAY;AACV,eAAO,CAAC,CAAR;AACD,OAFD,MAEO;AACL,eAAO,CAAP;AACD;AACF,KA/ByB,CAiC1B;;;AACA,WAAO,uCAACR,CAAC,CAACY,QAAH,gDAAC,YAAYN,OAAZ,EAAD,qEAA0B,CAA1B,2CAAgCL,CAAC,CAACW,QAAlC,gDAAgC,YAAYN,OAAZ,EAAhC,qEAAyD,CAAzD,CAAP;AACD,GAnCD;;AAqCA,MAAItC,gBAAJ,EAAsB;AACpB,UAAM6C,QAAQ,GAAG1D,YAAY,CAAC2D,OAAb,CAAqB9C,gBAArB,CAAjB;;AACA,QAAI6C,QAAQ,IAAI,CAAhB,EAAmB;AACjB1D,MAAAA,YAAY,CAAC4D,MAAb,CAAoBF,QAApB,EAA8B,CAA9B;;AACA,UAAI1D,YAAY,CAAC6D,MAAb,GAAsB,CAA1B,EAA6B;AAC3B7D,QAAAA,YAAY,CAAC4D,MAAb,CAAoB,CAApB,EAAuB,CAAvB,EAA0B/C,gBAA1B;AACD,OAFD,MAEO;AACLb,QAAAA,YAAY,CAACc,IAAb,CAAkBD,gBAAlB;AACD;AACF;AACF;AACF","sourcesContent":["import {\n AudioTrack,\n ConnectionState,\n LocalParticipant,\n Participant,\n RemoteTrack,\n Room,\n RoomEvent,\n Track,\n} from 'livekit-client';\nimport { useEffect, useState } from 'react';\n\nexport interface RoomState {\n room?: Room;\n /* all participants in the room, including the local participant. */\n participants: Participant[];\n /* all subscribed audio tracks in the room, not including local participant. */\n audioTracks: AudioTrack[];\n error?: Error;\n}\n\nexport interface RoomOptions {\n sortParticipants?: (participants: Participant[]) => void;\n}\n\n/** @deprecated wrap your components in a <LiveKitRoom> component instead and use more granular hooks to track state you're interested in */\nexport function useRoom(room: Room, options?: RoomOptions): RoomState {\n const [error] = useState<Error>();\n const [participants, setParticipants] = useState<Participant[]>([]);\n const [audioTracks, setAudioTracks] = useState<AudioTrack[]>([]);\n\n const sortFunc = options?.sortParticipants ?? sortParticipants;\n\n useEffect(() => {\n const onParticipantsChanged = () => {\n const remotes = Array.from(room.remoteParticipants.values());\n const newParticipants: Participant[] = [room.localParticipant];\n newParticipants.push(...remotes);\n sortFunc(newParticipants, room.localParticipant);\n setParticipants(newParticipants);\n };\n const onSubscribedTrackChanged = (track?: RemoteTrack) => {\n // ordering may have changed, re-sort\n onParticipantsChanged();\n if (track && track.kind !== Track.Kind.Audio) {\n return;\n }\n const tracks: AudioTrack[] = [];\n room.remoteParticipants.forEach((p) => {\n p.audioTrackPublications.forEach((pub) => {\n if (pub.audioTrack) {\n tracks.push(pub.audioTrack);\n }\n });\n });\n setAudioTracks(tracks);\n };\n\n const onConnectionStateChanged = (state: ConnectionState) => {\n if (state === ConnectionState.Connected) {\n onParticipantsChanged();\n }\n };\n\n room.once(RoomEvent.Disconnected, () => {\n room\n .off(RoomEvent.ParticipantConnected, onParticipantsChanged)\n .off(RoomEvent.ParticipantDisconnected, onParticipantsChanged)\n .off(RoomEvent.ActiveSpeakersChanged, onParticipantsChanged)\n .off(RoomEvent.TrackSubscribed, onSubscribedTrackChanged)\n .off(RoomEvent.TrackUnsubscribed, onSubscribedTrackChanged)\n .off(RoomEvent.LocalTrackPublished, onParticipantsChanged)\n .off(RoomEvent.LocalTrackUnpublished, onParticipantsChanged)\n .off(RoomEvent.AudioPlaybackStatusChanged, onParticipantsChanged)\n .off(RoomEvent.ConnectionStateChanged, onConnectionStateChanged);\n });\n room\n .on(RoomEvent.ConnectionStateChanged, onConnectionStateChanged)\n .on(RoomEvent.Reconnected, onParticipantsChanged)\n .on(RoomEvent.ParticipantConnected, onParticipantsChanged)\n .on(RoomEvent.ParticipantDisconnected, onParticipantsChanged)\n .on(RoomEvent.ActiveSpeakersChanged, onParticipantsChanged)\n .on(RoomEvent.TrackSubscribed, onSubscribedTrackChanged)\n .on(RoomEvent.TrackUnsubscribed, onSubscribedTrackChanged)\n .on(RoomEvent.LocalTrackPublished, onParticipantsChanged)\n .on(RoomEvent.LocalTrackUnpublished, onParticipantsChanged)\n // trigger a state change by re-sorting participants\n .on(RoomEvent.AudioPlaybackStatusChanged, onParticipantsChanged);\n\n onSubscribedTrackChanged();\n\n return () => {\n room.disconnect();\n };\n }, [room, sortFunc]);\n\n return {\n error,\n participants,\n audioTracks,\n };\n}\n\n/**\n * Default sort for participants, it'll order participants by:\n * 1. dominant speaker (speaker with the loudest audio level)\n * 2. local participant\n * 3. other speakers that are recently active\n * 4. participants with video on\n * 5. by joinedAt\n */\nexport function sortParticipants(\n participants: Participant[],\n localParticipant?: LocalParticipant\n) {\n participants.sort((a, b) => {\n // loudest speaker first\n if (a.isSpeaking && b.isSpeaking) {\n return b.audioLevel - a.audioLevel;\n }\n\n // speaker goes first\n if (a.isSpeaking !== b.isSpeaking) {\n if (a.isSpeaking) {\n return -1;\n } else {\n return 1;\n }\n }\n\n // last active speaker first\n if (a.lastSpokeAt !== b.lastSpokeAt) {\n const aLast = a.lastSpokeAt?.getTime() ?? 0;\n const bLast = b.lastSpokeAt?.getTime() ?? 0;\n return bLast - aLast;\n }\n\n // video on\n const aVideo = a.videoTrackPublications.size > 0;\n const bVideo = b.videoTrackPublications.size > 0;\n if (aVideo !== bVideo) {\n if (aVideo) {\n return -1;\n } else {\n return 1;\n }\n }\n\n // joinedAt\n return (a.joinedAt?.getTime() ?? 0) - (b.joinedAt?.getTime() ?? 0);\n });\n\n if (localParticipant) {\n const localIdx = participants.indexOf(localParticipant);\n if (localIdx >= 0) {\n participants.splice(localIdx, 1);\n if (participants.length > 0) {\n participants.splice(1, 0, localParticipant);\n } else {\n participants.push(localParticipant);\n }\n }\n }\n}\n"]}
1
+ {"version":3,"names":["ConnectionState","RoomEvent","Track","useEffect","useState","useRoom","room","options","error","participants","setParticipants","audioTracks","setAudioTracks","sortFunc","sortParticipants","onParticipantsChanged","remotes","Array","from","remoteParticipants","values","newParticipants","localParticipant","push","onSubscribedTrackChanged","track","kind","Kind","Audio","tracks","forEach","p","audioTrackPublications","pub","audioTrack","onConnectionStateChanged","state","Connected","once","Disconnected","off","ParticipantConnected","ParticipantDisconnected","ActiveSpeakersChanged","TrackSubscribed","TrackUnsubscribed","LocalTrackPublished","LocalTrackUnpublished","AudioPlaybackStatusChanged","ConnectionStateChanged","on","Reconnected","disconnect","sort","a","b","_a$joinedAt","_b$joinedAt","isSpeaking","audioLevel","lastSpokeAt","_a$lastSpokeAt","_b$lastSpokeAt","aLast","getTime","bLast","aVideo","videoTrackPublications","size","bVideo","joinedAt","localIdx","indexOf","splice","length"],"sources":["useRoom.ts"],"sourcesContent":["import {\n type AudioTrack,\n ConnectionState,\n LocalParticipant,\n Participant,\n RemoteTrack,\n Room,\n RoomEvent,\n Track,\n} from 'livekit-client';\nimport { useEffect, useState } from 'react';\n\nexport interface RoomState {\n room?: Room;\n /* all participants in the room, including the local participant. */\n participants: Participant[];\n /* all subscribed audio tracks in the room, not including local participant. */\n audioTracks: AudioTrack[];\n error?: Error;\n}\n\nexport interface RoomOptions {\n sortParticipants?: (participants: Participant[]) => void;\n}\n\n/** @deprecated wrap your components in a <LiveKitRoom> component instead and use more granular hooks to track state you're interested in */\nexport function useRoom(room: Room, options?: RoomOptions): RoomState {\n const [error] = useState<Error>();\n const [participants, setParticipants] = useState<Participant[]>([]);\n const [audioTracks, setAudioTracks] = useState<AudioTrack[]>([]);\n\n const sortFunc = options?.sortParticipants ?? sortParticipants;\n\n useEffect(() => {\n const onParticipantsChanged = () => {\n const remotes = Array.from(room.remoteParticipants.values());\n const newParticipants: Participant[] = [room.localParticipant];\n newParticipants.push(...remotes);\n sortFunc(newParticipants, room.localParticipant);\n setParticipants(newParticipants);\n };\n const onSubscribedTrackChanged = (track?: RemoteTrack) => {\n // ordering may have changed, re-sort\n onParticipantsChanged();\n if (track && track.kind !== Track.Kind.Audio) {\n return;\n }\n const tracks: AudioTrack[] = [];\n room.remoteParticipants.forEach((p) => {\n p.audioTrackPublications.forEach((pub) => {\n if (pub.audioTrack) {\n tracks.push(pub.audioTrack);\n }\n });\n });\n setAudioTracks(tracks);\n };\n\n const onConnectionStateChanged = (state: ConnectionState) => {\n if (state === ConnectionState.Connected) {\n onParticipantsChanged();\n }\n };\n\n room.once(RoomEvent.Disconnected, () => {\n room\n .off(RoomEvent.ParticipantConnected, onParticipantsChanged)\n .off(RoomEvent.ParticipantDisconnected, onParticipantsChanged)\n .off(RoomEvent.ActiveSpeakersChanged, onParticipantsChanged)\n .off(RoomEvent.TrackSubscribed, onSubscribedTrackChanged)\n .off(RoomEvent.TrackUnsubscribed, onSubscribedTrackChanged)\n .off(RoomEvent.LocalTrackPublished, onParticipantsChanged)\n .off(RoomEvent.LocalTrackUnpublished, onParticipantsChanged)\n .off(RoomEvent.AudioPlaybackStatusChanged, onParticipantsChanged)\n .off(RoomEvent.ConnectionStateChanged, onConnectionStateChanged);\n });\n room\n .on(RoomEvent.ConnectionStateChanged, onConnectionStateChanged)\n .on(RoomEvent.Reconnected, onParticipantsChanged)\n .on(RoomEvent.ParticipantConnected, onParticipantsChanged)\n .on(RoomEvent.ParticipantDisconnected, onParticipantsChanged)\n .on(RoomEvent.ActiveSpeakersChanged, onParticipantsChanged)\n .on(RoomEvent.TrackSubscribed, onSubscribedTrackChanged)\n .on(RoomEvent.TrackUnsubscribed, onSubscribedTrackChanged)\n .on(RoomEvent.LocalTrackPublished, onParticipantsChanged)\n .on(RoomEvent.LocalTrackUnpublished, onParticipantsChanged)\n // trigger a state change by re-sorting participants\n .on(RoomEvent.AudioPlaybackStatusChanged, onParticipantsChanged);\n\n onSubscribedTrackChanged();\n\n return () => {\n room.disconnect();\n };\n }, [room, sortFunc]);\n\n return {\n error,\n participants,\n audioTracks,\n };\n}\n\n/**\n * Default sort for participants, it'll order participants by:\n * 1. dominant speaker (speaker with the loudest audio level)\n * 2. local participant\n * 3. other speakers that are recently active\n * 4. participants with video on\n * 5. by joinedAt\n */\nexport function sortParticipants(\n participants: Participant[],\n localParticipant?: LocalParticipant\n) {\n participants.sort((a, b) => {\n // loudest speaker first\n if (a.isSpeaking && b.isSpeaking) {\n return b.audioLevel - a.audioLevel;\n }\n\n // speaker goes first\n if (a.isSpeaking !== b.isSpeaking) {\n if (a.isSpeaking) {\n return -1;\n } else {\n return 1;\n }\n }\n\n // last active speaker first\n if (a.lastSpokeAt !== b.lastSpokeAt) {\n const aLast = a.lastSpokeAt?.getTime() ?? 0;\n const bLast = b.lastSpokeAt?.getTime() ?? 0;\n return bLast - aLast;\n }\n\n // video on\n const aVideo = a.videoTrackPublications.size > 0;\n const bVideo = b.videoTrackPublications.size > 0;\n if (aVideo !== bVideo) {\n if (aVideo) {\n return -1;\n } else {\n return 1;\n }\n }\n\n // joinedAt\n return (a.joinedAt?.getTime() ?? 0) - (b.joinedAt?.getTime() ?? 0);\n });\n\n if (localParticipant) {\n const localIdx = participants.indexOf(localParticipant);\n if (localIdx >= 0) {\n participants.splice(localIdx, 1);\n if (participants.length > 0) {\n participants.splice(1, 0, localParticipant);\n } else {\n participants.push(localParticipant);\n }\n }\n }\n}\n"],"mappings":"AAAA,SAEEA,eAAe,EAKfC,SAAS,EACTC,KAAK,QACA,gBAAgB;AACvB,SAASC,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAe3C;AACA,OAAO,SAASC,OAAOA,CAACC,IAAU,EAAEC,OAAqB,EAAa;EACpE,MAAM,CAACC,KAAK,CAAC,GAAGJ,QAAQ,CAAQ,CAAC;EACjC,MAAM,CAACK,YAAY,EAAEC,eAAe,CAAC,GAAGN,QAAQ,CAAgB,EAAE,CAAC;EACnE,MAAM,CAACO,WAAW,EAAEC,cAAc,CAAC,GAAGR,QAAQ,CAAe,EAAE,CAAC;EAEhE,MAAMS,QAAQ,GAAG,CAAAN,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEO,gBAAgB,KAAIA,gBAAgB;EAE9DX,SAAS,CAAC,MAAM;IACd,MAA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rB,IAAIH,MAAM,EAAE;QACV,OAAO,CAAC,CAAC;MACX,CAAC,MAAM;QACL,OAAO,CAAC;MACV;IACF;;IAEA;IACA,OAAO,CAAC,EAAAV,WAAA,GAAAF,CAAC,CAACgB,QAAQ,cAAAd,WAAA,uBAAVA,WAAA,CAAYQ,OAAO,CAAC,CAAC,KAAI,CAAC,KAAK,EAAAP,WAAA,GAAAF,CAAC,CAACe,QAAQ,cAAAb,WAAA,uBAAVA,WAAA,CAAYO,OAAO,CAAC,CAAC,KAAI,CAAC,CAAC;EACpE,CAAC,CAAC;EAEF,IAAI1C,gBAAgB,EAAE;IACpB,MAAMiD,QAAQ,GAAG9D,YAAY,CAAC+D,OAAO,CAAClD,gBAAgB,CAAC;IACvD,IAAIiD,QAAQ,IAAI,CAAC,EAAE;MACjB9D,YAAY,CAACgE,MAAM,CAACF,QAAQ,EAAE,CAAC,CAAC;MAChC,IAAI9D,YAAY,CAACiE,MAAM,GAAG,CAAC,EAAE;QAC3BjE,YAAY,CAACgE,MAAM,CAAC,CAAC,EAAE,CAAC,EAAEnD,gBAAgB,CAAC;MAC7C,CAAC,MAAM;QACLb,YAAY,CAACc,IAAI,CAACD,gBAAgB,CAAC;MACrC;IACF;EACF;AACF","ignoreList":[]}
@@ -0,0 +1 @@
1
+ export const presets: string[];
File without changes
File without changes
File without changes
File without changes
@@ -0,0 +1,10 @@
1
+ export const __esModule: boolean;
2
+ /**
3
+ * Handles setting the appropriate AVAudioSession options automatically
4
+ * depending on the audio track states of the Room.
5
+ *
6
+ * @param room
7
+ * @param preferSpeakerOutput
8
+ * @param onConfigureNativeAudio A custom method for determining options used.
9
+ */
10
+ export function useIOSAudioManagement(room: any, preferSpeakerOutput: boolean | undefined, onConfigureNativeAudio: any): void;
@@ -0,0 +1,33 @@
1
+ export const __esModule: boolean;
2
+ export namespace AndroidAudioTypePresets {
3
+ namespace communication {
4
+ const manageAudioFocus: boolean;
5
+ const audioMode: string;
6
+ const audioFocusMode: string;
7
+ const audioStreamType: string;
8
+ const audioAttributesUsageType: string;
9
+ const audioAttributesContentType: string;
10
+ }
11
+ namespace media {
12
+ const manageAudioFocus_1: boolean;
13
+ export { manageAudioFocus_1 as manageAudioFocus };
14
+ const audioMode_1: string;
15
+ export { audioMode_1 as audioMode };
16
+ const audioFocusMode_1: string;
17
+ export { audioFocusMode_1 as audioFocusMode };
18
+ const audioStreamType_1: string;
19
+ export { audioStreamType_1 as audioStreamType };
20
+ const audioAttributesUsageType_1: string;
21
+ export { audioAttributesUsageType_1 as audioAttributesUsageType };
22
+ const audioAttributesContentType_1: string;
23
+ export { audioAttributesContentType_1 as audioAttributesContentType };
24
+ }
25
+ }
26
+ export default AudioSession;
27
+ export function getDefaultAppleAudioConfigurationForMode(mode: any, preferSpeakerOutput?: boolean): {
28
+ audioCategory: string;
29
+ audioCategoryOptions: string[];
30
+ audioMode: string;
31
+ };
32
+ declare class AudioSession {
33
+ }
@@ -0,0 +1,20 @@
1
+ export const __esModule: boolean;
2
+ /** @public */
3
+ /**
4
+ * The `LiveKitRoom` component provides the room context to all its child components.
5
+ * It is generally the starting point of your LiveKit app and the root of the LiveKit component tree.
6
+ * It provides the room state as a React context to all child components, so you don't have to pass it yourself.
7
+ *
8
+ * @example
9
+ * ```tsx
10
+ * <LiveKitRoom
11
+ * token='<livekit-token>'
12
+ * serverUrl='<url-to-livekit-server>'
13
+ * connect={true}
14
+ * >
15
+ * ...
16
+ * </LiveKitRoom>
17
+ * ```
18
+ * @public
19
+ */
20
+ export function LiveKitRoom(props: any): any;
@@ -0,0 +1,8 @@
1
+ export const __esModule: boolean;
2
+ export function VideoTrack({ style, trackRef, objectFit, zOrder, mirror }: {
3
+ style?: {} | undefined;
4
+ trackRef: any;
5
+ objectFit?: string | undefined;
6
+ zOrder: any;
7
+ mirror: any;
8
+ }): any;
@@ -0,0 +1,14 @@
1
+ export const __esModule: boolean;
2
+ /**
3
+ * @deprecated use `VideoTrack` and `VideoTrackProps` instead.
4
+ */
5
+ /**
6
+ * @deprecated use `VideoTrack` and `VideoTrackProps` instead.
7
+ */
8
+ export function VideoView({ style, videoTrack, objectFit, zOrder, mirror }: {
9
+ style?: {} | undefined;
10
+ videoTrack: any;
11
+ objectFit?: string | undefined;
12
+ zOrder: any;
13
+ mirror: any;
14
+ }): any;
@@ -0,0 +1,30 @@
1
+ export const __esModule: boolean;
2
+ export default ViewPortDetector;
3
+ declare const ViewPortDetector_base: any;
4
+ /**
5
+ * Detects when this is in the viewport and visible.
6
+ *
7
+ * Will not fire visibility changes for zero width/height components.
8
+ */
9
+ declare class ViewPortDetector extends ViewPortDetector_base {
10
+ [x: string]: any;
11
+ constructor(props: any);
12
+ lastAppStateActive: any;
13
+ interval: TimeoutHandler | null;
14
+ lastValue: any;
15
+ state: {
16
+ rectTop: number;
17
+ rectBottom: number;
18
+ };
19
+ componentDidMount(): void;
20
+ appStateSubscription: any;
21
+ componentWillUnmount(): void;
22
+ UNSAFE_componentWillReceiveProps(nextProps: any): void;
23
+ render(): any;
24
+ view: any;
25
+ }
26
+ declare class TimeoutHandler {
27
+ set handler(arg: any);
28
+ get handler(): any;
29
+ clear(): void;
30
+ }
@@ -0,0 +1,29 @@
1
+ export const __esModule: boolean;
2
+ export const ParticipantContext: any;
3
+ export const RoomContext: any;
4
+ export const TrackRefContext: any;
5
+ export const isTrackReference: any;
6
+ export const useChat: any;
7
+ export const useConnectionState: any;
8
+ export const useDataChannel: any;
9
+ export const useEnsureTrackRef: any;
10
+ export const useIsEncrypted: any;
11
+ export const useIsMuted: any;
12
+ export const useIsSpeaking: any;
13
+ export const useLiveKitRoom: any;
14
+ export const useLocalParticipant: any;
15
+ export const useLocalParticipantPermissions: any;
16
+ export const useParticipantContext: any;
17
+ export const useParticipantInfo: any;
18
+ export const useParticipantTracks: any;
19
+ export const useParticipants: any;
20
+ export const useRemoteParticipant: any;
21
+ export const useRemoteParticipants: any;
22
+ export const useRoomContext: any;
23
+ export const useRoomInfo: any;
24
+ export const useSortedParticipants: any;
25
+ export const useSpeakingParticipants: any;
26
+ export const useTrackMutedIndicator: any;
27
+ export const useTrackRefContext: any;
28
+ export const useTracks: any;
29
+ export const useVisualStableUpdate: any;
@@ -0,0 +1,10 @@
1
+ export const __esModule: boolean;
2
+ export const AndroidAudioTypePresets: any;
3
+ export const AudioSession: any;
4
+ export const getDefaultAppleAudioConfigurationForMode: any;
5
+ /**
6
+ * Registers the required globals needed for LiveKit to work.
7
+ *
8
+ * Must be called before using LiveKit.
9
+ */
10
+ export function registerGlobals(): void;
@@ -0,0 +1,8 @@
1
+ export const __esModule: boolean;
2
+ export const log: any;
3
+ /**
4
+ * Set the log level for both the `@livekit/react-native` package and the `@livekit-client` package.
5
+ * To set the `@livekit-client` log independently, use the `liveKitClientLogLevel` prop on the `options` object.
6
+ * @public
7
+ */
8
+ export function setLogLevel(level: any, options?: {}): void;
@@ -0,0 +1,14 @@
1
+ export const __esModule: boolean;
2
+ /** @deprecated use `useRemoteParticipant` or `useLocalParticipant` instead */
3
+ /** @deprecated use `useRemoteParticipant` or `useLocalParticipant` instead */
4
+ export function useParticipant(participant: any): {
5
+ isLocal: boolean;
6
+ isSpeaking: any;
7
+ connectionQuality: any;
8
+ publications: any;
9
+ subscribedTracks: any;
10
+ cameraPublication: any;
11
+ microphonePublication: any;
12
+ screenSharePublication: any;
13
+ metadata: any;
14
+ };
@@ -0,0 +1,16 @@
1
+ export const __esModule: boolean;
2
+ /**
3
+ * Default sort for participants, it'll order participants by:
4
+ * 1. dominant speaker (speaker with the loudest audio level)
5
+ * 2. local participant
6
+ * 3. other speakers that are recently active
7
+ * 4. participants with video on
8
+ * 5. by joinedAt
9
+ */
10
+ export function sortParticipants(participants: any, localParticipant: any): void;
11
+ /** @deprecated wrap your components in a <LiveKitRoom> component instead and use more granular hooks to track state you're interested in */
12
+ export function useRoom(room: any, options: any): {
13
+ error: any;
14
+ participants: any;
15
+ audioTracks: any;
16
+ };
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Handles setting the appropriate AVAudioSession options automatically
3
+ * depending on the audio track states of the Room.
4
+ *
5
+ * @param room
6
+ * @param preferSpeakerOutput
7
+ * @param onConfigureNativeAudio A custom method for determining options used.
8
+ */
9
+ export function useIOSAudioManagement(room: any, preferSpeakerOutput: boolean | undefined, onConfigureNativeAudio: any): void;
@@ -0,0 +1,31 @@
1
+ export function getDefaultAppleAudioConfigurationForMode(mode: any, preferSpeakerOutput?: boolean): {
2
+ audioCategory: string;
3
+ audioCategoryOptions: string[];
4
+ audioMode: string;
5
+ };
6
+ export namespace AndroidAudioTypePresets {
7
+ namespace communication {
8
+ const manageAudioFocus: boolean;
9
+ const audioMode: string;
10
+ const audioFocusMode: string;
11
+ const audioStreamType: string;
12
+ const audioAttributesUsageType: string;
13
+ const audioAttributesContentType: string;
14
+ }
15
+ namespace media {
16
+ const manageAudioFocus_1: boolean;
17
+ export { manageAudioFocus_1 as manageAudioFocus };
18
+ const audioMode_1: string;
19
+ export { audioMode_1 as audioMode };
20
+ const audioFocusMode_1: string;
21
+ export { audioFocusMode_1 as audioFocusMode };
22
+ const audioStreamType_1: string;
23
+ export { audioStreamType_1 as audioStreamType };
24
+ const audioAttributesUsageType_1: string;
25
+ export { audioAttributesUsageType_1 as audioAttributesUsageType };
26
+ const audioAttributesContentType_1: string;
27
+ export { audioAttributesContentType_1 as audioAttributesContentType };
28
+ }
29
+ }
30
+ export default class AudioSession {
31
+ }
@@ -0,0 +1,22 @@
1
+ /** @public */
2
+ /**
3
+ * The `LiveKitRoom` component provides the room context to all its child components.
4
+ * It is generally the starting point of your LiveKit app and the root of the LiveKit component tree.
5
+ * It provides the room state as a React context to all child components, so you don't have to pass it yourself.
6
+ *
7
+ * @example
8
+ * ```tsx
9
+ * <LiveKitRoom
10
+ * token='<livekit-token>'
11
+ * serverUrl='<url-to-livekit-server>'
12
+ * connect={true}
13
+ * >
14
+ * ...
15
+ * </LiveKitRoom>
16
+ * ```
17
+ * @public
18
+ */
19
+ export function LiveKitRoom(props: any): React.FunctionComponentElement<{
20
+ children?: React.ReactNode;
21
+ }>;
22
+ import * as React from 'react';
@@ -0,0 +1,9 @@
1
+ export function VideoTrack({ style, trackRef, objectFit, zOrder, mirror }: {
2
+ style?: {} | undefined;
3
+ trackRef: any;
4
+ objectFit?: string | undefined;
5
+ zOrder: any;
6
+ mirror: any;
7
+ }): React.CElement<import("react-native").ViewProps, View>;
8
+ import { View } from 'react-native';
9
+ import * as React from 'react';
@@ -0,0 +1,9 @@
1
+ export function VideoView({ style, videoTrack, objectFit, zOrder, mirror }: {
2
+ style?: {} | undefined;
3
+ videoTrack: any;
4
+ objectFit?: string | undefined;
5
+ zOrder: any;
6
+ mirror: any;
7
+ }): React.CElement<import("react-native").ViewProps, View>;
8
+ import { View } from 'react-native';
9
+ import * as React from 'react';
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Detects when this is in the viewport and visible.
3
+ *
4
+ * Will not fire visibility changes for zero width/height components.
5
+ */
6
+ export default class ViewPortDetector extends React.Component<any, any, any> {
7
+ constructor(props: any);
8
+ lastAppStateActive: any;
9
+ interval: TimeoutHandler | null;
10
+ lastValue: any;
11
+ state: {
12
+ rectTop: number;
13
+ rectBottom: number;
14
+ };
15
+ componentDidMount(): void;
16
+ appStateSubscription: import("react-native").NativeEventSubscription | null | undefined;
17
+ componentWillUnmount(): void;
18
+ UNSAFE_componentWillReceiveProps(nextProps: any): void;
19
+ render(): React.CElement<import("react-native").ViewProps, View>;
20
+ view: any;
21
+ }
22
+ import React from 'react';
23
+ declare class TimeoutHandler {
24
+ set handler(arg: any);
25
+ get handler(): any;
26
+ clear(): void;
27
+ }
28
+ import { View } from 'react-native';
29
+ export {};
@@ -0,0 +1 @@
1
+ export { useConnectionState, useDataChannel, useIsSpeaking, useLocalParticipant, useLocalParticipantPermissions, useParticipantInfo, useParticipants, useRemoteParticipants, useRemoteParticipant, useSpeakingParticipants, useSortedParticipants, useChat, useIsEncrypted, useRoomInfo, useIsMuted, useParticipantTracks, useLiveKitRoom, RoomContext, useRoomContext, ParticipantContext, useParticipantContext, TrackRefContext, useTrackRefContext, useTracks, isTrackReference, useEnsureTrackRef, useTrackMutedIndicator, useVisualStableUpdate } from "@livekit/components-react";
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Registers the required globals needed for LiveKit to work.
3
+ *
4
+ * Must be called before using LiveKit.
5
+ */
6
+ export function registerGlobals(): void;
7
+ export * from "./hooks";
8
+ export * from "./components/LiveKitRoom";
9
+ export * from "./components/VideoTrack";
10
+ export * from "./components/VideoView";
11
+ export * from "./useParticipant";
12
+ export * from "./useRoom";
13
+ export * from "./logger";
14
+ export * from "./audio/AudioManager";
15
+ import AudioSession from './audio/AudioSession';
16
+ import { AndroidAudioTypePresets } from './audio/AudioSession';
17
+ import { getDefaultAppleAudioConfigurationForMode } from './audio/AudioSession';
18
+ export { AudioSession, AndroidAudioTypePresets, getDefaultAppleAudioConfigurationForMode };
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Set the log level for both the `@livekit/react-native` package and the `@livekit-client` package.
3
+ * To set the `@livekit-client` log independently, use the `liveKitClientLogLevel` prop on the `options` object.
4
+ * @public
5
+ */
6
+ export function setLogLevel(level: any, options?: {}): void;
7
+ export const log: loglevel.Logger;
8
+ import loglevel from 'loglevel';
@@ -0,0 +1,13 @@
1
+ /** @deprecated use `useRemoteParticipant` or `useLocalParticipant` instead */
2
+ /** @deprecated use `useRemoteParticipant` or `useLocalParticipant` instead */
3
+ export function useParticipant(participant: any): {
4
+ isLocal: boolean;
5
+ isSpeaking: boolean;
6
+ connectionQuality: any;
7
+ publications: never[];
8
+ subscribedTracks: never[];
9
+ cameraPublication: any;
10
+ microphonePublication: any;
11
+ screenSharePublication: any;
12
+ metadata: undefined;
13
+ };
@@ -0,0 +1,15 @@
1
+ /** @deprecated wrap your components in a <LiveKitRoom> component instead and use more granular hooks to track state you're interested in */
2
+ export function useRoom(room: any, options: any): {
3
+ error: undefined;
4
+ participants: never[];
5
+ audioTracks: never[];
6
+ };
7
+ /**
8
+ * Default sort for participants, it'll order participants by:
9
+ * 1. dominant speaker (speaker with the loudest audio level)
10
+ * 2. local participant
11
+ * 3. other speakers that are recently active
12
+ * 4. participants with video on
13
+ * 5. by joinedAt
14
+ */
15
+ export function sortParticipants(participants: any, localParticipant: any): void;
@@ -0,0 +1 @@
1
+ export {};
@@ -18,8 +18,6 @@
18
18
  *
19
19
  * See {@link AndroidAudioTypePresets} for pre-configured values.
20
20
  *
21
- * NOTE: If `audioTypeOptions` is set, this must also be reflected in your android MainApplication setup.
22
- *
23
21
  * ----
24
22
  * iOS
25
23
  *
@@ -27,7 +25,7 @@
27
25
  *
28
26
  * By default, this is set to `"speaker"`
29
27
  */
30
- export declare type AudioConfiguration = {
28
+ export type AudioConfiguration = {
31
29
  android?: {
32
30
  preferredOutputList?: ('speaker' | 'earpiece' | 'headset' | 'bluetooth')[];
33
31
  audioTypeOptions: AndroidAudioTypeOptions;
@@ -36,7 +34,7 @@ export declare type AudioConfiguration = {
36
34
  defaultOutput?: 'speaker' | 'earpiece';
37
35
  };
38
36
  };
39
- export declare type AndroidAudioTypeOptions = {
37
+ export type AndroidAudioTypeOptions = {
40
38
  /**
41
39
  * Whether LiveKit should handle managing the audio focus or not.
42
40
  *
@@ -102,15 +100,15 @@ export declare const AndroidAudioTypePresets: {
102
100
  */
103
101
  media: AndroidAudioTypeOptions;
104
102
  };
105
- export declare type AppleAudioMode = 'default' | 'gameChat' | 'measurement' | 'moviePlayback' | 'spokenAudio' | 'videoChat' | 'videoRecording' | 'voiceChat' | 'voicePrompt';
106
- export declare type AppleAudioCategory = 'soloAmbient' | 'playback' | 'record' | 'playAndRecord' | 'multiRoute';
107
- export declare type AppleAudioCategoryOption = 'mixWithOthers' | 'duckOthers' | 'interruptSpokenAudioAndMixWithOthers' | 'allowBluetooth' | 'allowBluetoothA2DP' | 'allowAirPlay' | 'defaultToSpeaker';
108
- export declare type AppleAudioConfiguration = {
103
+ export type AppleAudioMode = 'default' | 'gameChat' | 'measurement' | 'moviePlayback' | 'spokenAudio' | 'videoChat' | 'videoRecording' | 'voiceChat' | 'voicePrompt';
104
+ export type AppleAudioCategory = 'soloAmbient' | 'playback' | 'record' | 'playAndRecord' | 'multiRoute';
105
+ export type AppleAudioCategoryOption = 'mixWithOthers' | 'duckOthers' | 'interruptSpokenAudioAndMixWithOthers' | 'allowBluetooth' | 'allowBluetoothA2DP' | 'allowAirPlay' | 'defaultToSpeaker';
106
+ export type AppleAudioConfiguration = {
109
107
  audioCategory?: AppleAudioCategory;
110
108
  audioCategoryOptions?: AppleAudioCategoryOption[];
111
109
  audioMode?: AppleAudioMode;
112
110
  };
113
- export declare type AudioTrackState = 'none' | 'remoteOnly' | 'localOnly' | 'localAndRemote';
111
+ export type AudioTrackState = 'none' | 'remoteOnly' | 'localOnly' | 'localAndRemote';
114
112
  export declare function getDefaultAppleAudioConfigurationForMode(mode: AudioTrackState, preferSpeakerOutput?: boolean): AppleAudioConfiguration;
115
113
  export default class AudioSession {
116
114
  /**
@@ -1,4 +1,4 @@
1
- import { FeatureFlags } from '@livekit/components-react';
1
+ import { type FeatureFlags } from '@livekit/components-react';
2
2
  import type { AudioCaptureOptions, RoomConnectOptions, RoomOptions, ScreenShareCaptureOptions, VideoCaptureOptions } from 'livekit-client';
3
3
  import type { MediaDeviceFailure, Room } from 'livekit-client';
4
4
  import * as React from 'react';
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
- import { ViewStyle } from 'react-native';
2
+ import { type ViewStyle } from 'react-native';
3
3
  import type { TrackReference } from '@livekit/components-react';
4
- export declare type VideoTrackProps = {
4
+ export type VideoTrackProps = {
5
5
  trackRef: TrackReference | undefined;
6
6
  style?: ViewStyle;
7
7
  objectFit?: 'cover' | 'contain' | undefined;
@@ -1,10 +1,10 @@
1
1
  import * as React from 'react';
2
- import { ViewStyle } from 'react-native';
3
- import { VideoTrack } from 'livekit-client';
2
+ import { type ViewStyle } from 'react-native';
3
+ import { type VideoTrack } from 'livekit-client';
4
4
  /**
5
5
  * @deprecated use `VideoTrack` and `VideoTrackProps` instead.
6
6
  */
7
- export declare type Props = {
7
+ export type Props = {
8
8
  videoTrack?: VideoTrack | undefined;
9
9
  style?: ViewStyle;
10
10
  objectFit?: 'cover' | 'contain' | undefined;
@@ -1,6 +1,6 @@
1
- import React, { Component, PropsWithChildren } from 'react';
2
- import { AppStateStatus, ViewStyle } from 'react-native';
3
- export declare type Props = {
1
+ import React, { Component, type PropsWithChildren } from 'react';
2
+ import { type AppStateStatus, type ViewStyle } from 'react-native';
3
+ export type Props = {
4
4
  disabled?: boolean;
5
5
  style?: ViewStyle;
6
6
  onChange?: (isVisible: boolean) => void;
@@ -0,0 +1,3 @@
1
+ export { useConnectionState, useDataChannel, useIsSpeaking, useLocalParticipant, useLocalParticipantPermissions, useParticipantInfo, useParticipants, useRemoteParticipants, useRemoteParticipant, useSpeakingParticipants, useSortedParticipants, useChat, useIsEncrypted, useRoomInfo, useIsMuted, useParticipantTracks, useLiveKitRoom, RoomContext, useRoomContext, ParticipantContext, useParticipantContext, TrackRefContext, useTrackRefContext, useTracks, isTrackReference, useEnsureTrackRef, useTrackMutedIndicator, useVisualStableUpdate, } from '@livekit/components-react';
2
+ export type { UseLocalParticipantOptions, UseParticipantInfoOptions, UseParticipantsOptions, UseRemoteParticipantOptions, UseRemoteParticipantsOptions, UseTracksOptions, TrackReference, TrackReferenceOrPlaceholder, UseVisualStableUpdateOptions, } from '@livekit/components-react';
3
+ export type { ReceivedDataMessage } from '@livekit/components-core';
@@ -0,0 +1,20 @@
1
+ import './polyfills/EncoderDecoderTogether.min.js';
2
+ import AudioSession, { AndroidAudioTypePresets, type AndroidAudioTypeOptions, type AppleAudioCategory, type AppleAudioCategoryOption, type AppleAudioConfiguration, type AppleAudioMode, type AudioTrackState, getDefaultAppleAudioConfigurationForMode } from './audio/AudioSession';
3
+ import type { AudioConfiguration } from './audio/AudioSession';
4
+ import type { LogLevel, SetLogLevelOptions } from './logger';
5
+ /**
6
+ * Registers the required globals needed for LiveKit to work.
7
+ *
8
+ * Must be called before using LiveKit.
9
+ */
10
+ export declare function registerGlobals(): void;
11
+ export * from './hooks';
12
+ export * from './components/LiveKitRoom';
13
+ export * from './components/VideoTrack';
14
+ export * from './components/VideoView';
15
+ export * from './useParticipant';
16
+ export * from './useRoom';
17
+ export * from './logger';
18
+ export * from './audio/AudioManager';
19
+ export { AudioSession, AndroidAudioTypePresets, getDefaultAppleAudioConfigurationForMode, };
20
+ export type { AudioConfiguration, AndroidAudioTypeOptions, AppleAudioCategory, AppleAudioCategoryOption, AppleAudioConfiguration, AppleAudioMode, AudioTrackState, LogLevel, SetLogLevelOptions, };
@@ -1,8 +1,8 @@
1
1
  import { setLogLevel as setClientSdkLogLevel } from 'livekit-client';
2
2
  import loglevel from 'loglevel';
3
3
  export declare const log: loglevel.Logger;
4
- export declare type LogLevel = Parameters<typeof setClientSdkLogLevel>[0];
5
- export declare type SetLogLevelOptions = {
4
+ export type LogLevel = Parameters<typeof setClientSdkLogLevel>[0];
5
+ export type SetLogLevelOptions = {
6
6
  liveKitClientLogLevel?: LogLevel;
7
7
  };
8
8
  /**
@@ -1,4 +1,4 @@
1
- import { AudioTrack, LocalParticipant, Participant, Room } from 'livekit-client';
1
+ import { type AudioTrack, LocalParticipant, Participant, Room } from 'livekit-client';
2
2
  export interface RoomState {
3
3
  room?: Room;
4
4
  participants: Participant[];