0

I have several Playwright tests that use a webcam to capture videos and photos. Now they work with stubs via '--use-fake-ui-for-media-stream','--use-fake-device-for-media-stream'

I would really like to dynamically use video mocks for happy e2e tests.

After studying the problem a little, I managed to mock public .mp4 streams into the video element used for the webcam feed.

In my CI/CD pipeline, all test data (including camera videos) are stored as pre-signed AWS S3 links like https://my-e2e.s3.amazonaws.com/resources/my-face.webm?AWSAccessKeyId=ABC123FAKE&Signature=ABC123FAKED&Expires=1660724194

But such videos don't work at all with the suggested CaptureStream workaround.

You can check the working snippet in jsfiddle playground

I have a bad feeling it might be restricted by:

Attempting to use captureStream() with a media element that implements content protection via Encrypted Media Extensions will throw an exception.

Or I am missing something about streaming videos from AWS...

UPD Oct 2022: Adding * as allowed origin to CORS settings of S3 bucket resolved my issue.

References:

sideshowbarker
  • 81,827
  • 26
  • 193
  • 197
  • You haven't encrypted the stream, so that warning shouldn't apply. What does the network tab of your browser's dev tools show? It's likely you have a cross-site error, and you'll need to [enable CORS](https://aws.amazon.com/premiumsupport/knowledge-center/s3-configure-cors/) for the bucket. – Anon Coward Aug 17 '22 at 17:29
  • Thanks! Indeed my s3 bucket didn't have any CORS configuration. I added * as the allowed origin and it works now! – Chaika Bogdan Oct 17 '22 at 11:45

0 Answers0