@fishjam-cloud/react-native-client 0.21.0 → 0.22.1

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 (77) hide show
  1. package/build/RNFishjamClientModule.d.ts +9 -4
  2. package/build/RNFishjamClientModule.d.ts.map +1 -1
  3. package/build/RNFishjamClientModule.js +1 -0
  4. package/build/RNFishjamClientModule.js.map +1 -1
  5. package/build/components/FishjamRoom/index.d.ts +6 -6
  6. package/build/components/FishjamRoom/index.d.ts.map +1 -1
  7. package/build/components/FishjamRoom/index.js +8 -10
  8. package/build/components/FishjamRoom/index.js.map +1 -1
  9. package/build/hooks/internal/useFishjamEvent.d.ts.map +1 -1
  10. package/build/hooks/internal/useFishjamEvent.js +3 -0
  11. package/build/hooks/internal/useFishjamEvent.js.map +1 -1
  12. package/build/hooks/useCallKit.d.ts +121 -0
  13. package/build/hooks/useCallKit.d.ts.map +1 -0
  14. package/build/hooks/useCallKit.js +142 -0
  15. package/build/hooks/useCallKit.js.map +1 -0
  16. package/build/hooks/useConnection.d.ts +20 -16
  17. package/build/hooks/useConnection.d.ts.map +1 -1
  18. package/build/hooks/useConnection.js +10 -11
  19. package/build/hooks/useConnection.js.map +1 -1
  20. package/build/hooks/useSandbox.d.ts +3 -3
  21. package/build/hooks/useSandbox.d.ts.map +1 -1
  22. package/build/hooks/useSandbox.js +3 -5
  23. package/build/hooks/useSandbox.js.map +1 -1
  24. package/build/index.d.ts +4 -17
  25. package/build/index.d.ts.map +1 -1
  26. package/build/index.js +3 -10
  27. package/build/index.js.map +1 -1
  28. package/build/livestream/components/LivestreamStreamer.d.ts.map +1 -0
  29. package/build/livestream/components/LivestreamStreamer.js.map +1 -0
  30. package/build/livestream/components/LivestreamViewer.d.ts.map +1 -0
  31. package/build/livestream/components/LivestreamViewer.js.map +1 -0
  32. package/build/livestream/hooks/useLivestreamStreamer.d.ts.map +1 -0
  33. package/build/{hooks → livestream/hooks}/useLivestreamStreamer.js +1 -1
  34. package/build/livestream/hooks/useLivestreamStreamer.js.map +1 -0
  35. package/build/livestream/hooks/useLivestreamViewer.d.ts.map +1 -0
  36. package/build/{hooks → livestream/hooks}/useLivestreamViewer.js +1 -1
  37. package/build/livestream/hooks/useLivestreamViewer.js.map +1 -0
  38. package/build/livestream/index.d.ts +11 -0
  39. package/build/livestream/index.d.ts.map +1 -0
  40. package/build/livestream/index.js +6 -0
  41. package/build/livestream/index.js.map +1 -0
  42. package/build/utils/config.d.ts +6 -0
  43. package/build/utils/config.d.ts.map +1 -0
  44. package/build/utils/config.js +10 -0
  45. package/build/utils/config.js.map +1 -0
  46. package/build/utils/eventPayloadValidator.d.ts.map +1 -1
  47. package/build/utils/eventPayloadValidator.js +17 -1
  48. package/build/utils/eventPayloadValidator.js.map +1 -1
  49. package/build/utils/getFishjamUrl.d.ts +2 -0
  50. package/build/utils/getFishjamUrl.d.ts.map +1 -0
  51. package/build/utils/getFishjamUrl.js +10 -0
  52. package/build/utils/getFishjamUrl.js.map +1 -0
  53. package/ios/Events.swift +26 -0
  54. package/ios/RNFishjamClient.swift +40 -4
  55. package/ios/RNFishjamClientModule.swift +221 -211
  56. package/livestream/package.json +4 -0
  57. package/package.json +2 -1
  58. package/plugin/build/types.d.ts +1 -0
  59. package/plugin/build/withFishjamIos.js +12 -0
  60. package/build/common/client.d.ts +0 -25
  61. package/build/common/client.d.ts.map +0 -1
  62. package/build/common/client.js +0 -14
  63. package/build/common/client.js.map +0 -1
  64. package/build/components/LivestreamStreamer.d.ts.map +0 -1
  65. package/build/components/LivestreamStreamer.js.map +0 -1
  66. package/build/components/LivestreamViewer.d.ts.map +0 -1
  67. package/build/components/LivestreamViewer.js.map +0 -1
  68. package/build/hooks/useLivestreamStreamer.d.ts.map +0 -1
  69. package/build/hooks/useLivestreamStreamer.js.map +0 -1
  70. package/build/hooks/useLivestreamViewer.d.ts.map +0 -1
  71. package/build/hooks/useLivestreamViewer.js.map +0 -1
  72. /package/build/{components → livestream/components}/LivestreamStreamer.d.ts +0 -0
  73. /package/build/{components → livestream/components}/LivestreamStreamer.js +0 -0
  74. /package/build/{components → livestream/components}/LivestreamViewer.d.ts +0 -0
  75. /package/build/{components → livestream/components}/LivestreamViewer.js +0 -0
  76. /package/build/{hooks → livestream/hooks}/useLivestreamStreamer.d.ts +0 -0
  77. /package/build/{hooks → livestream/hooks}/useLivestreamViewer.d.ts +0 -0
@@ -1 +0,0 @@
1
- {"version":3,"file":"useLivestreamViewer.js","sourceRoot":"","sources":["../../src/hooks/useLivestreamViewer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAC5E,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAM7C,MAAM,aAAa,GAAG,CAAC,MAA2B,EAAE,EAAE;IACpD,IAAI,MAAM,CAAC,QAAQ;QAAE,OAAO,GAAG,gBAAgB,IAAI,MAAM,CAAC,QAAQ,EAAE,CAAC;IACrE,OAAO,gBAAgB,CAAC;AAC1B,CAAC,CAAC;AAkBF;;;;GAIG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,GAA8B,EAAE;IACjE,MAAM,KAAK,GAAG,sBAAsB,EAAE,CAAC;IACvC,MAAM,WAAW,GAAG,KAAK,KAAK,WAAW,CAAC;IAE1C,MAAM,UAAU,GAAG,MAAM,CAAoB,IAAI,CAAC,CAAC;IAEnD,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,YAAY,GAAG,GAAG,EAAE;YACxB,UAAU,CAAC,OAAO,GAAG,IAAI,UAAU,CAAC;gBAClC,YAAY,EAAE,IAAI;gBAClB,YAAY,EAAE,IAAI;aACnB,CAAC,CAAC;QACL,CAAC,CAAC;QACF,YAAY,EAAE,CAAC;QAEf,OAAO,GAAG,EAAE;YACV,UAAU,CAAC,OAAO,EAAE,UAAU,EAAE,CAAC;QACnC,CAAC,CAAC;IACJ,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,MAAM,OAAO,GAAG,WAAW,CACzB,KAAK,EAAE,MAA2B,EAAE,GAAY,EAAE,EAAE;QAClD,MAAM,UAAU,CAAC,OAAO,EAAE,OAAO,CAAC;YAChC,SAAS,EAAE,GAAG,IAAI,aAAa,CAAC,MAAM,CAAC;YACvC,SAAS,EAAE,MAAM,CAAC,KAAK;SACxB,CAAC,CAAC;IACL,CAAC,EACD,EAAE,CACH,CAAC;IAEF,MAAM,UAAU,GAAG,WAAW,CAAC,KAAK,IAAI,EAAE;QACxC,MAAM,UAAU,CAAC,OAAO,EAAE,UAAU,EAAE,CAAC;IACzC,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO;QACL,OAAO;QACP,UAAU;QACV,WAAW;KACZ,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { useCallback, useEffect, useRef } from 'react';\nimport { WhepClient, useWhepConnectionState } from 'react-native-whip-whep';\nimport { FISHJAM_WHEP_URL } from '../consts';\n\nexport type ConnectViewerConfig =\n | { token: string; streamId?: never }\n | { streamId: string; token?: never };\n\nconst urlFromConfig = (config: ConnectViewerConfig) => {\n if (config.streamId) return `${FISHJAM_WHEP_URL}/${config.streamId}`;\n return FISHJAM_WHEP_URL;\n};\n\n/**\n * @category Livestream\n */\nexport interface useLivestreamViewerResult {\n /**\n * Callback to start receiving a livestream.\n * If the livestream is private, provide `token`.\n * If the livestream is public, provide `streamId`.\n */\n connect: (config: ConnectViewerConfig, url?: string) => Promise<void>;\n /** Disconnect from a stream previously connected to with {@link connect} */\n disconnect: () => Promise<void>;\n /** Utility flag which indicates the current connection status */\n isConnected: boolean;\n}\n\n/**\n * Hook for receiving a published livestream.\n * @category Livestream\n * @group Hooks\n */\nexport const useLivestreamViewer = (): useLivestreamViewerResult => {\n const state = useWhepConnectionState();\n const isConnected = state === 'connected';\n\n const whepClient = useRef<WhepClient | null>(null);\n\n useEffect(() => {\n const createClient = () => {\n whepClient.current = new WhepClient({\n audioEnabled: true,\n videoEnabled: true,\n });\n };\n createClient();\n\n return () => {\n whepClient.current?.disconnect();\n };\n }, []);\n\n const connect = useCallback(\n async (config: ConnectViewerConfig, url?: string) => {\n await whepClient.current?.connect({\n serverUrl: url ?? urlFromConfig(config),\n authToken: config.token,\n });\n },\n [],\n );\n\n const disconnect = useCallback(async () => {\n await whepClient.current?.disconnect();\n }, []);\n\n return {\n connect,\n disconnect,\n isConnected,\n };\n};\n"]}