Video optimizations (#18)
* use events for `VideoTrackRenderer` * logger * implemented visibility detection * optimize code with 1 param debounce func * stop pending visibility event when disposed * clean up * mark internal * report to track * call dispose on pub and track * use internal events to receive visibility events * clean up visibility for disposed track * listen to track visibility events on pub * re-design * quickly re-enable * clean up * clean up
This commit is contained in:
@@ -1,11 +1,15 @@
|
||||
// added
|
||||
import 'package:flutter_webrtc/flutter_webrtc.dart' as rtc;
|
||||
import 'package:visibility_detector/visibility_detector.dart';
|
||||
import 'package:meta/meta.dart';
|
||||
|
||||
import '../events.dart';
|
||||
import '../track/track.dart';
|
||||
|
||||
abstract class InternalEvent implements LiveKitEvent {}
|
||||
|
||||
@internal
|
||||
abstract class EngineIceStateUpdatedEvent with EngineEvent {
|
||||
abstract class EngineIceStateUpdatedEvent with EngineEvent, InternalEvent {
|
||||
final rtc.RTCIceConnectionState iceState;
|
||||
final bool isPrimary;
|
||||
const EngineIceStateUpdatedEvent({
|
||||
@@ -35,3 +39,25 @@ class EnginePublisherIceStateUpdatedEvent extends EngineIceStateUpdatedEvent {
|
||||
isPrimary: isPrimary,
|
||||
);
|
||||
}
|
||||
|
||||
@internal
|
||||
class TrackStreamUpdatedEvent with TrackEvent, InternalEvent {
|
||||
final Track track;
|
||||
final rtc.MediaStream stream;
|
||||
const TrackStreamUpdatedEvent({
|
||||
required this.track,
|
||||
required this.stream,
|
||||
});
|
||||
}
|
||||
|
||||
@internal
|
||||
class TrackVisibilityUpdatedEvent with TrackEvent, InternalEvent {
|
||||
final String rendererId;
|
||||
final Track track;
|
||||
final VisibilityInfo? info; // null means disposed
|
||||
const TrackVisibilityUpdatedEvent({
|
||||
required this.rendererId,
|
||||
required this.track,
|
||||
required this.info,
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user