Showing
1 changed file
with
13 additions
and
0 deletions
| @@ -8,6 +8,19 @@ final class MediaTrackConstraintsDelegate { | @@ -8,6 +8,19 @@ final class MediaTrackConstraintsDelegate { | ||
| 8 | /// Constructs a [MediaTrackConstraintsDelegate] instance. | 8 | /// Constructs a [MediaTrackConstraintsDelegate] instance. |
| 9 | const MediaTrackConstraintsDelegate(); | 9 | const MediaTrackConstraintsDelegate(); |
| 10 | 10 | ||
| 11 | + /// Get the constraints for the given [mediaStream]. | ||
| 12 | + MediaTrackConstraints? getConstraints(MediaStream? mediaStream) { | ||
| 13 | + final List<JSAny?> tracks = mediaStream?.getVideoTracks().toDart ?? const []; | ||
| 14 | + | ||
| 15 | + if (tracks.isEmpty) { | ||
| 16 | + return null; | ||
| 17 | + } | ||
| 18 | + | ||
| 19 | + final MediaStreamTrack? track = tracks.first as MediaStreamTrack?; | ||
| 20 | + | ||
| 21 | + return track?.getConstraints(); | ||
| 22 | + } | ||
| 23 | + | ||
| 11 | /// Returns a list of supported flashlight modes for the given [mediaStream]. | 24 | /// Returns a list of supported flashlight modes for the given [mediaStream]. |
| 12 | /// | 25 | /// |
| 13 | /// The [TorchState.off] mode is always supported, regardless of the return value. | 26 | /// The [TorchState.off] mode is always supported, regardless of the return value. |
-
Please register or login to post a comment