equality for video types
This commit is contained in:
@@ -24,6 +24,19 @@ class VideoDimensions {
|
||||
width ?? this.width,
|
||||
height ?? this.height,
|
||||
);
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// equality
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) =>
|
||||
identical(this, other) ||
|
||||
other is VideoDimensions &&
|
||||
width == other.width &&
|
||||
height == other.height;
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(width, height);
|
||||
}
|
||||
|
||||
extension VideoDimensionsHelpers on VideoDimensions {
|
||||
|
||||
@@ -15,6 +15,19 @@ class VideoEncoding {
|
||||
@override
|
||||
String toString() =>
|
||||
'${runtimeType}(maxFramerate: ${maxFramerate}, maxBitrate: ${maxBitrate})';
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// equality
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) =>
|
||||
identical(this, other) ||
|
||||
other is VideoEncoding &&
|
||||
maxFramerate == other.maxFramerate &&
|
||||
maxBitrate == other.maxBitrate;
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(maxFramerate, maxBitrate);
|
||||
}
|
||||
|
||||
/// Convenience extension for [VideoEncoding].
|
||||
|
||||
@@ -15,6 +15,20 @@ class VideoParameters {
|
||||
required this.encoding,
|
||||
});
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// equality
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) =>
|
||||
identical(this, other) ||
|
||||
other is VideoParameters &&
|
||||
description == other.description &&
|
||||
dimensions == other.dimensions &&
|
||||
encoding == other.encoding;
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(description, dimensions, encoding);
|
||||
|
||||
//
|
||||
// TODO: Return constraints that will work for all platforms (Web & Mobile)
|
||||
// https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia
|
||||
|
||||
Reference in New Issue
Block a user