diff --git a/Lombiq.Tests.UI/Docs/FakeVideoCaptureSource.md b/Lombiq.Tests.UI/Docs/FakeVideoCaptureSource.md index c4e899765..15907be86 100644 --- a/Lombiq.Tests.UI/Docs/FakeVideoCaptureSource.md +++ b/Lombiq.Tests.UI/Docs/FakeVideoCaptureSource.md @@ -8,22 +8,24 @@ You can use `y4m` or `mjpeg` video files as a fake video capture source in the C If you have a video file in e.g. `mp4` format, use your preferred video tool to convert it to one of the formats mentioned above. If you don't have a preferred tool, simply use `ffmpeg`. -_Hint: The `mjpeg` format will usually result in a smaller file size._ +> ℹ️ The `mjpeg` format will usually result in a smaller file size. ```bash # Convert mp4 to y4m. ffmpeg -y -i test.mp4 -pix_fmt yuv420p test.y4m # Convert with resize to 480p. -ffmpeg -y -i test.mp4 -filter:v scale=480:-1 -pix_fmt yuv420p test.y4m +ffmpeg -y -i test.mp4 -vf "scale=480:720" -pix_fmt yuv420p test.y4m # Convert mp4 to mjpeg. ffmpeg -y -i test.mp4 test.mjpeg # Convert with resize to 480p. -ffmpeg -y -i test.mp4 -filter:v scale=480:-1 test.mjpeg +ffmpeg -y -i test.mp4 -vf "scale=480:720" test.mjpeg ``` +> ⚠ Using the `-filter:v scale=480:-1` command might "ruin" the video, resulting in a black screen in the browser without warnings. + ## Sample You can find a usage example under [Lombiq Vue.js module for Orchard Core - UI Test Extensions](https://github.com/Lombiq/Orchard-Vue.js/tree/dev/Lombiq.VueJs.Tests.UI). diff --git a/Lombiq.Tests.UI/Services/WebDriverFactory.cs b/Lombiq.Tests.UI/Services/WebDriverFactory.cs index 35570b69e..0b30f475a 100644 --- a/Lombiq.Tests.UI/Services/WebDriverFactory.cs +++ b/Lombiq.Tests.UI/Services/WebDriverFactory.cs @@ -154,6 +154,9 @@ private static TDriverOptions SetCommonChromiumOptions( { var fakeCameraSourceFilePath = configuration.FakeVideoSource.SaveVideoToTempFolder(); + // In some cases the video would not start automatically. To avoid this scenario we are adding the + // "disable-gesture-requirement-for-media-playback" flag. + options.AddArgument("disable-gesture-requirement-for-media-playback"); options.AddArgument("use-fake-device-for-media-stream"); options.AddArgument("use-fake-ui-for-media-stream"); options.AddArgument($"use-file-for-fake-video-capture={fakeCameraSourceFilePath}");