kSourceCandidates top-level constant
The ordered video sources to try on each platform, best first.
Android had a fallback chain from the start; Linux did not, and Linux is the
platform where the first choice most often fails — v4l2src device=/dev/video0
is wrong on any machine with no webcam, a webcam on video1, or a webcam
that cannot produce MJPEG at the requested geometry. Before this list the
page just showed a dead texture in all three cases.
Every chain ends in videotestsrc, which needs no hardware: reaching the
last entry means "the app works, your camera does not", and that is a far
more useful thing to put on screen than a blank rectangle.
Implementation
const Map<TargetPlatform, List<String>> kSourceCandidates =
<TargetPlatform, List<String>>{
TargetPlatform.android: <String>[
'ahcsrc',
'autovideosrc',
'videotestsrc',
],
TargetPlatform.linux: <String>['v4l2src', 'autovideosrc', 'videotestsrc'],
TargetPlatform.macOS: <String>['avfvideosrc', 'videotestsrc'],
TargetPlatform.windows: <String>['ksvideosrc', 'videotestsrc'],
};