8000 refactor: Use webrtc interface. by cloudwebrtc · Pull Request #777 · flutter-webrtc/flutter-webrtc · GitHub
[go: up one dir, main page]

Skip to content

refactor: Use webrtc interface. #777

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Nov 25, 2021
Merged

Conversation

cloudwebrtc
Copy link
Member
@cloudwebrtc cloudwebrtc commented Nov 22, 2021

If we split flutter_webrtc into three packages, we will be able to support flutter native, flutter web, and dart web at the same time.

and we can use different packages to maintain multiple platforms in the future. #692 (comment)

close #692

TODO:

@cloudwebrtc cloudwebrtc changed the title refactor: Use external interface. refactor: Use webrtc interface. Nov 22, 2021
Copy link
Contributor
@wer-mathurin wer-mathurin left a comment

Choose a reason for hiding this comment

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

This is a big updates!

@@ -48,7 +49,7 @@ class _RTCVideoViewState extends State<RTCVideoView> {

@override
void dispose() {
widget._renderer.delegate.removeListener(_onRendererListener);
videoRenderer.removeListener(_onRendererListener);
super.dispose();
}

Copy link
Contributor

Choose a reason for hiding this comment

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

@cloudwebrtc: I know you didn't change the following (in the void didUpdateWidget(RTCVideoView oldWidget))

Timer(
    Duration(milliseconds: 10), () => videoRenderer.mirror = widget.mirror);

But I have a hard time figure it out why we would poll each 10 milliseconds if we need to mirror the value. Why we are not able to listen to a change of the value!

Copy link
Member Author

Choose a reason for hiding this comment

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

I also think this is not necessary and should be removed.

import 'interface/enums.dart';
import 'interface/media_recorder.dart' as _interface;
import 'interface/media_stream.dart';
import 'interface/media_stream_track.dart';

class MediaRecorder extends _interface.MediaRecorder {
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we can rename the class as MediaRecorderDelegate to make it obvious what it is. So you will not need to use the as _interface in this case :-)

Copy link
Member Author

Choose a reason for hiding this comment

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

I want to remove MediaRecorder from the interface because this interface is completely dependent on the platform implementation and is not a standard in the WebRTC API

import '../interface/mediadevices.dart';
import '../interface/navigator.dart';
import 'package:webrtc_interface/webrtc_interface.dart';

import 'mediadevices_impl.dart';

class NavigatorNative extends Navigator {
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we can let go this class since it does the same thing as MediaDevices. Or at least mark it as deprecated

Copy link
Member Author

Choose a reason for hiding this comment

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

I think it is currently marked as deprecated, try not to break the API, remain unchanged in version 1.0, and deprecated in 2.x

@@ -34,6 +36,9 @@ class RTCVideoRendererNative extends VideoRenderer {
@override
MediaStream? get srcObject => _srcObject;

@override
Function? onResize;
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we can be more clear about the signature of onResize at the interface level.
void Function()? onResize;

Copy link
Member Author

Choose a reason for hiding this comment

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

@cloudwebrtc cloudwebrtc merged commit e44812b into master Nov 25, 2021
Copy link
Contributor
@wer-mathurin wer-mathurin left a comment

Choose a reason for hiding this comment

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

We need to remove the listener at some point.

@wer-mathurin
Copy link
Contributor
wer-mathurin commented Nov 25, 2021 via email

@cloudwebrtc
Copy link
Member Author
cloudwebrtc commented Nov 25, 2021

I add comments on the PR. But you merge it before sawing it :-)

I‘m so sorry,I needed an urgent transitional version, so I merged it in advance. A separate version of dart web and flutter, I merged it without breaking any API.

@cloudwebrtc cloudwebrtc deleted the refactor/separate-interface branch July 27, 2022 16:25
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.

Split flutter-webrtc pacakge to interface/native/web
2 participants
0