Skip to content

Conversation

@anna1901
Copy link
Contributor

Description

Overwrite MediaStream for mobile with the one from RN WebRTC.

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 Jan 16, 2026

@anna1901 anna1901 changed the base branch from main to mobile-sdk-2-0 January 16, 2026 15:18
@anna1901 anna1901 requested a review from Copilot January 16, 2026 15:20
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 addresses type inconsistencies between the web-based MediaStream and React Native WebRTC's MediaStream implementation by overwriting return types in the mobile client package. The changes ensure that hooks and components working with media streams use the correct RNMediaStream type, which includes the toURL() method required by React Native.

Changes:

  • Updated mobile-client package to re-export hooks with RNMediaStream types instead of web MediaStream
  • Removed workaround type assertions (MediaStreamWithURL) from example applications
  • Added main entry point configuration to video-player example

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/mobile-client/src/index.ts Created wrapper functions for hooks to override MediaStream types with RNMediaStream; re-exported custom types
examples/mobile-client/video-player/package.json Added main entry point field
examples/mobile-client/video-player/index.js Added new root component registration file
examples/mobile-client/video-player/app.json Added main entry point field
examples/mobile-client/video-player/components/FishjamPlayerViewer.tsx Removed MediaStreamWithURL workaround; simplified stream usage
examples/mobile-client/video-player/components/FishjamPlayerStreamer.tsx Removed MediaStreamWithURL workaround; simplified stream usage
examples/mobile-client/minimal-react-native/components/VideosGridItem.tsx Removed MediaStreamWithURL workaround and TODO comments
examples/mobile-client/fishjam-chat/components/VideosGrid.tsx Removed MediaStreamWithURL workaround and TODO comments
examples/mobile-client/fishjam-chat/app/room/preview.tsx Removed MediaStreamWithURL workaround and unused videoRoomEnv parameter
examples/mobile-client/fishjam-chat/app/livestream/viewer.tsx Removed MediaStreamWithURL workaround
examples/mobile-client/fishjam-chat/app/livestream/streamer.tsx Removed MediaStreamWithURL workaround

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

}

export const VideosGridItem = ({ peer }: { peer: GridTrack }) => {
//TODO: FCE-2487 overwrite Track to include MediaStream from react-native-webrtc
Copy link
Collaborator

Choose a reason for hiding this comment

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

issue (non-blocking): Should this comment be deleted as well? Task name matches.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, thanks


import App from './App';

registerRootComponent(App);
Copy link
Collaborator

Choose a reason for hiding this comment

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

question: Why was this needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure, but this example wasn't working without it.

};
}

export function useCamera(): Omit<ReturnType<typeof useCameraReactClient>, 'cameraStream'> & {
Copy link
Collaborator

Choose a reason for hiding this comment

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

issue (blocking): Can we rewrite the types in pure typescript way? Right now if something changes in the react code it might not be reflected in mobile version. For example for the useCamera hook, it could be rewritten as:

export const useCamera = useCameraReactClient as () => Omit<
  ReturnType<typeof useCameraReactClient>,
  'cameraStream'
> & {
  cameraStream: RNMediaStream | null;
};

that way the output JS code will not change but only TS types.

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.

3 participants