Skip to content

FCE-2959: Fix MediaStream type#511

Open
MiloszFilimowski wants to merge 8 commits intomainfrom
FCE-2959-fix-media-stream-type
Open

FCE-2959: Fix MediaStream type#511
MiloszFilimowski wants to merge 8 commits intomainfrom
FCE-2959-fix-media-stream-type

Conversation

@MiloszFilimowski
Copy link
Collaborator

@MiloszFilimowski MiloszFilimowski commented Mar 27, 2026

Description

  • Override MediaStream types with RNMediaStream from @fishjam-cloud/react-native-webrtc across the mobile client package
  • Move hook re-exports (useCamera, useMicrophone, useScreenShare, useCustomSource, useLivestreamStreamer, useLivestreamViewer) into a new overrides/hooks.ts module with corrected RN-specific stream types
  • Add overrides/types.ts with mobile-specific type aliases (Track, CustomSource, InitializeDevicesResult, etc.) that replace web MediaStream with RNMediaStream
  • Fix RTCView / RTCPIPView props to use RNMediaStream instead of the global MediaStream

Motivation and Context

The mobile client was using the web MediaStream type in several places, causing type mismatches on React Native where the actual runtime object is RNMediaStream. This centralises all stream-type overrides and fixes the incorrect types.

Documentation impact

  • Documentation update required
  • Documentation updated in another PR
  • No documentation update required

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to
    not work as expected)

@linear
Copy link

linear bot commented Mar 27, 2026

@MiloszFilimowski MiloszFilimowski changed the title FCE-3017: Document audio output FCE-2959: Fix MediaStream type Mar 27, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the mobile SDK’s public API typings to better match React Native runtime behavior by re-typing the useCamera hook’s cameraStream as React Native WebRTC’s MediaStream rather than the web DOM MediaStream.

Changes:

  • Re-export useCamera from @fishjam-cloud/react-client with an overridden return type so cameraStream is typed as RNMediaStream | null.
  • Adjust imports/exports in the mobile client entrypoint to support the new typing.
Comments suppressed due to low confidence (1)

packages/mobile-client/src/index.ts:69

  • useCamera is re-typed to return an RN MediaStream, but useMicrophone still exposes microphoneStream from @fishjam-cloud/react-client, which is also constructed via new MediaStream(...) and will remain typed as the web MediaStream for React Native consumers. Consider applying the same return-type override pattern to useMicrophone (for microphoneStream) to avoid inconsistent/incorrect stream types in the mobile SDK API surface.
export const useMicrophone = useMicrophoneReactClient as () => Omit<
  ReturnType<typeof useMicrophoneReactClient>,
  'toggleMicrophoneMute'
>;

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants