Obito__29
Obito__29

Reputation: 1

getstream.io with Flutter: How to Add Additional Participants to an Existing Call and Send Push Notifications?

I’m using the getStream.io video call API in Flutter and following the documentation to manage participants. The code below allows me to create or get an existing call using a call ID:

// Create or get an existing call
await client.call('default', 'test-outgoing-call').getOrCreate({
  ring: true,
  data: {
    created_by_id: 'myself',
    members: [{ user_id: 'myself' }, { user_id: 'my friend' }],
  },
});

When I create a new call with this code, the initial participants receive push notifications to answer or decline the call. However, when I try to add more participants to an existing call using the same method, the newly added participants do not receive any push notifications. Here’s the code I used:

const callType = 'default';
const callId = 'test-outgoing-call'; // ID of the existing call
const call = client.video.call(callType, callId);

await call.getOrCreate({
  ring: true,
  data: {
    created_by_id: 'myself',
    members: [
      { user_id: 'myself' },
      { user_id: 'friend 1' },
      { user_id: 'friend 2' }
    ],
  },
});
// friend 1 and friend 2 are the newly added participants to the existing call.

The response is successful, with no errors, but friend 1 and friend 2 do not receive notifications to join the call.

I also tried this approach in Flutter using the Stream Video SDK, but it didn’t work as expected. So, I moved to the server side, hoping that would resolve the issue. Below is the code used in Flutter:

final call = StreamVideo.instance.makeCall(callType: StreamCallType.defaultType(), id: 'My-existing-call-ID');
await call.getOrCreate(memberIds: ['USER1', 'USER2'], ring: true);

Upvotes: 0

Views: 75

Answers (0)

Related Questions