Skip to content

Conversation

@Jaemin-VIRNECT
Copy link
Contributor

iOS and AOS support (tested on iOS and AOS mobile devices)

How to use?

final videoTrack = _localStream!
.getVideoTracks()
.firstWhere((track) => track.kind == 'video');
await WebRTC.invokeMethod('mediaStreamTrackSetZoom',
<String, dynamic>{'trackId': videoTrack.id, 'zoomLevel': zoomLevel});

//After this PR is published.
(webrtc_interface version needs to be updated in pubspec.yaml)

await videoTrack.setZoom(zoomLevel);

Jaemin-VIRNECT and others added 4 commits August 10, 2023 11:25
@cloudwebrtc
Copy link
Member

cloudwebrtc commented Aug 11, 2023

hey @Jaemin-VIRNECT, Tested it out this is a cool feature, but since zoom is only supported on iOS/Android, I recommend adding it to the Helper https:github.com/flutter-webrtc/flutter-webrtc/blob/main/lib/src/helper.dart

class Helper { .... Future<void> setZoom({MediaStreamTrack videoTrack, double zoomLevel}) { if(WebRTC.platformIsAndroid || WebRTC.platformIsiOS) { await WebRTC.invokeMethod( 'mediaStreamTrackSetZoom', <String, dynamic>{'trackId': videoTrack.id, 'zoomLevel': zoomLevel}, ); } else { throw Exception('setZoom only support for mobile devices!'); } } ... } await Helper.setZoom(videoTrack, zoomLevel); 
Copy link
Member

@cloudwebrtc cloudwebrtc left a comment

Choose a reason for hiding this comment

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

lgtm!

@Jaemin-VIRNECT
Copy link
Contributor Author

Thank you for the fast review.
I will update it soon. 😀

@cloudwebrtc cloudwebrtc merged commit 37eb6dc into flutter-webrtc:main Aug 11, 2023
@cloudwebrtc
Copy link
Member

hey @Jaemin-VIRNECT, Thank you for your PR, I have modified and merged, :)

@abhinovpankaj
Copy link

abhinovpankaj commented Feb 6, 2025

How do I use this, I am using flutter_webrtc: ^0.12.6 and webrtc_interface: ^1.2.0 but I get error that setZoom method is notdefined on videoTrack.
image

Am I missing something?

daniel-g-favoreto-opl pushed a commit to daniel-g-favoreto-opl/flutter-webrtc that referenced this pull request Mar 24, 2025
…ter-webrtc#1412) * Added setZoom method to support camera zoom function. * Update media_stream_track_impl.dart Resolve dart format error * Update media_stream_track_impl.dart Uncomment @OverRide on setZoom method after webrtc_interface is updated. * Update FlutterRTCMediaStream.m macOS not supported. * move setZoom into Helper. --------- Co-authored-by: duanweiwei1982@gmail.com <duanweiwei1982@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants