Camera Zoom

Zooming the local participant’s camera is a feature that users often expect in video applications. The StreamVideo SDK makes this easy by handling all interactions with the device’s camera for you.

Basic Usage

To zoom the camera, simply call the setZoom method on the Call instance and provide the desired zoomLevel:

await call.setZoom(zoomLevel: 1.5);

The zoomLevel parameter accepts a double value where:

  • 1.0 represents the default zoom (no zoom)
  • Values greater than 1.0 increase the zoom level

Example Implementation

The following example demonstrates how to toggle between normal view and zoomed view when a user double-taps on the local video:

bool zoomed = false;

StreamCallContainer(
  call: call,
  callContentBuilder: (
    BuildContext context,
    Call call,
    CallState callState,
  ) {
    return StreamCallContent(
      call: call,
      callState: callState,
      callParticipantsBuilder: (context, call, callState) {
        return StreamCallParticipants(
          call: call,
          participants: callState.callParticipants,
          localVideoParticipantBuilder: (context, call, participant) {
            return GestureDetector(
              onDoubleTap: () {
                call.setZoom(
                  zoomLevel: zoomed ? 1.0 : 2.0,
                );

                setState(() {
                  zoomed = !zoomed;
                });
              },
              child: StreamCallParticipant(
                key: Key(participant.uniqueParticipantKey),
                call: call,
                participant: participant,
              ),
            );
          },
        );
      },
    );
  },
)

Platform Support

Camera zoom functionality is available on both iOS and Android platforms. Support for specific zoom levels may vary depending on the device’s camera capabilities.

© Getstream.io, Inc. All Rights Reserved.