Skip to content

[WIP] Flutter Web (WIP, don't merge) #120

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 45 commits into from
Nov 19, 2019
Merged

[WIP] Flutter Web (WIP, don't merge) #120

merged 45 commits into from
Nov 19, 2019

Conversation

rostopira
Copy link
Collaborator

@rostopira rostopira commented Aug 22, 2019

Adds support for Flutter Web

  • P2P
  • Data Channel (text)
  • Data Channel (binary)
  • getUserMedia
  • getDisplayMedia
  • getSources
  • Sending video/audio
  • Displaying video/audio (waiting for pr merge)
  • Capture frame (works only once for no reason)
  • Video/audio recording (gives blob)
  • Camera switch

Linked issue #85

@rostopira
Copy link
Collaborator Author

@cloudwebrtc As you can see, there is some code duplication
What about moving all enums to another file like enums.dart?

@rostopira
Copy link
Collaborator Author

Note: in every file you can see imports:

// ignore: uri_does_not_exist
import 'dart:html' as HTML;
// ignore: uri_does_not_exist
import 'dart:js' as JS;

This is required to force Dart Analyzer to shut up

@rostopira rostopira self-assigned this Aug 22, 2019
@cloudwebrtc
Copy link
Member

@cloudwebrtc As you can see, there is some code duplication
What about moving all enums to another file like enums.dart?

Yes, this is a good idea.

@rostopira
Copy link
Collaborator Author

rostopira commented Sep 2, 2019

HtmlElementView is now available on master, but...

  /// The unique identifier for the HTML view type to be embedded by this widget.
  ///
  /// A PlatformViewFactory for this type must have been registered.

But it's not exposed API, so registering view factory requires some hackery with modifying engine files, but I were curious about it, so I even created and run PoC
Screen Shot 2019-09-02 at 17 12 04
I will continue tracking PR's in master branch, and will provide working code asap

initialize() async {
if (!_isViewFactoryRegistered) {
// ignore: implementation_imports
ui.platformViewRegistry.registerViewFactory('webrtc_video', (int viewId) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Dart Analyzer will yell on this, just ignore it

@cloudwebrtc
Copy link
Member

@rostopira Great, just now, I tried the branch and getUserMedia works fine.

@rostopira
Copy link
Collaborator Author

@cloudwebrtc For now I can't get multiple videos, video needs additional play() if you navigated to another page and back, multiple issues with frame capture and recording on OS X (windows is fine), everything else is pretty working in my project (P2P/video/audio)

@cloudwebrtc
Copy link
Member

I tried to debug it, but vscode doesn't seem to be able to debug the flutter web project, I will try again on the weekend.

@cloudwebrtc
Copy link
Member

@rostopira I have modified getDisplayMedia to get the screen object, but I get it to JsObject. I haven't found a way to convert this JsObject to MediaStream. Because it is stored in a private variable.

@cloudwebrtc
Copy link
Member

getDisplayMedia is working fine.

@cloudwebrtc
Copy link
Member

Switch camera in Chrome will trigger SDP re-negotiation, I have not found a better way. :(

@cloudwebrtc cloudwebrtc merged commit 35407e2 into master Nov 19, 2019
@cloudwebrtc cloudwebrtc deleted the flutter_web branch January 17, 2020 09:40
cloudwebrtc added a commit that referenced this pull request Jul 4, 2020
evdokimovs pushed a commit to evdokimovs/flutter-webrtc that referenced this pull request Jun 6, 2024
…em settings on Linux (flutter-webrtc#120)

Co-authored-by: alexlapa <lapa.alex@ex.ua>
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