Fix: Visibility Optimization randomly not working (#65)

* use widget id instead of state id

* ignore local video view events

* switch remote view visibility also

* use Key for a reliable id

* remove local check

* clean up

* redesign

* check mounted

* remove mount check

* more optimization

* quick wake up

* mark internal

* rename to adaptiveStream
This commit is contained in:
Hiroshi Horie
2022-01-01 12:59:24 +07:00
committed by GitHub
parent 2b375033e9
commit 38328c5e0d
11 changed files with 134 additions and 175 deletions
+20 -1
View File
@@ -1,3 +1,4 @@
import 'package:flutter/material.dart';
import 'package:flutter_webrtc/flutter_webrtc.dart' as rtc;
import 'package:meta/meta.dart';
@@ -16,7 +17,25 @@ import 'audio.dart';
import 'video.dart';
/// Used to group [LocalVideoTrack] and [RemoteVideoTrack].
mixin VideoTrack on Track {}
mixin VideoTrack on Track {
@internal
final List<GlobalKey> viewKeys = [];
@internal
Function(Key)? onVideoViewBuild;
@internal
GlobalKey addViewKey() {
final key = GlobalKey();
viewKeys.add(key);
return key;
}
@internal
void removeViewKey(GlobalKey key) {
viewKeys.remove(key);
}
}
/// Used to group [LocalAudioTrack] and [RemoteAudioTrack].
mixin AudioTrack on Track {}