fix(webkit): ensure WebKit can play h264 video (#3272)

This commit is contained in:
Yury Semikhatsky 2020-08-03 16:06:57 -07:00 committed by GitHub
parent 402d1a6a67
commit de55fa6482
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 22 additions and 3 deletions

View File

@ -33,7 +33,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
RUN apt-get update && apt-get install -y --no-install-recommends \
libgstreamer-gl1.0-0 \
libgstreamer-plugins-bad1.0-0 \
gstreamer1.0-plugins-good
gstreamer1.0-plugins-good \
gstreamer1.0-libav
# 4. Install Chromium dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \

View File

@ -0,0 +1,15 @@
<html>
<body>
<video width="400" controls>
<source src="movie.mp4" type="video/mp4">
Your browser does not support h.264 HTML video.
</video>
<p>
Video courtesy of
<a href="https://www.bigbuckbunny.org/" target="_blank">Big Buck Bunny</a>.
</p>
</body>
</html>

View File

@ -53,11 +53,14 @@ it.fail(WEBKIT && WIN)('should play video', async({page}) => {
// TODO: the test passes on Windows locally but fails on GitHub Action bot,
// apparently due to a Media Pack issue in the Windows Server.
//
// Safari only plays mp4 so we test WebKit with an .mp4 clip.
const fileName = WEBKIT ? 'video_mp4.html' : 'video.html';
const absolutePath = path.join(ASSETS_DIR, fileName);
// Our test server doesn't support range requests required to play on Mac,
// so we load the page using a file url.
const url = WIN
? 'file:///' + path.join(ASSETS_DIR, 'video.html').replace(/\\/g, '/')
: 'file://' + path.join(ASSETS_DIR, 'video.html');
? 'file:///' + absolutePath.replace(/\\/g, '/')
: 'file://' + absolutePath;
await page.goto(url);
await page.$eval('video', v => v.play());
await page.$eval('video', v => v.pause());