Skip to content

Commit 6fc0dc7

Browse files
authored
feat: Add useSVGIcons option (#8260)
1 parent 6c4997d commit 6fc0dc7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+1455
-365
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ Video.js is [licensed][license] under the Apache License, Version 2.0.
143143

144144
[npm-link]: https://nodei.co/npm/video.js/
145145

146-
[options]: docs/guides/options.md
146+
[options]: https://videojs.com/guides/options/
147147

148148
[plugins]: https://videojs.com/plugins/
149149

build/netlify.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,17 @@ sh.rm('-rf', deployDir);
2222
// make sure the directory exists
2323
sh.mkdir('-p', deployDir);
2424

25+
// create sub-directory for images
26+
sh.mkdir('-p', `${deployDir}/src`);
27+
2528
// create nested directories
2629
files
2730
.map((file) => path.dirname(file))
2831
.forEach((dir) => sh.mkdir('-p', path.join(deployDir, dir)));
2932

3033
// copy files/folders to deploy dir
3134
files
32-
.concat('dist', 'index.html', 'sandbox', 'docs')
35+
.concat('dist', 'index.html', 'sandbox', 'docs', 'src/images')
3336
.forEach((file) => sh.cp('-r', file, path.join(deployDir, file)));
3437

3538
sh.rm(path.join(deployDir, 'dist', `video-js-${pkg.version}.zip`));

index.html

+2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ <h2>Navigation</h2>
1414
<li><a href="sandbox/responsive.html">Responsive Demo</a></li>
1515
<li><a href="sandbox/middleware-play.html">Middleware Play Demo</a></li>
1616
<li><a href="sandbox/icons.html">Icons Demo</a></li>
17+
<li><a href="sandbox/svg-icons.html">SVG Icons Directory</a></li>
18+
<li><a href="sandbox/svg-icons-enabled.html">SVG Icons Demo</a></li>
1719
<li><a href="sandbox/focus-visible.html">Focus Visible Demo</a></li>
1820
<li><a href="sandbox/embeds.html">Embeds Demo</a></li>
1921
<li><a href="sandbox/descriptions.html">Descriptions Demo</a></li>

package-lock.json

+409-341
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+2
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@
104104
"@babel/core": "^7.9.0",
105105
"@babel/plugin-transform-runtime": "^7.9.0",
106106
"@babel/preset-env": "^7.9.0",
107+
"@rollup/plugin-image": "^3.0.2",
107108
"@rollup/plugin-replace": "^2.4.1",
108109
"@types/node": "^18.8.3",
109110
"access-sniff": "^3.2.0",
@@ -155,6 +156,7 @@
155156
"rollup-plugin-node-resolve": "^4.2.4",
156157
"rollup-plugin-progress": "^1.1.2",
157158
"rollup-plugin-stub": "^1.2.0",
159+
"rollup-plugin-svg": "^2.0.0",
158160
"sass": "^1.34.0",
159161
"semver": "^5.7.0",
160162
"shelljs": "^0.8.5",

rollup.config.js

+10
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,10 @@ import multiEntry from 'rollup-plugin-multi-entry';
1313
import stub from 'rollup-plugin-stub';
1414
import isCI from 'is-ci';
1515
import replace from '@rollup/plugin-replace';
16+
import image from '@rollup/plugin-image';
1617
import istanbul from 'rollup-plugin-istanbul';
1718
import externalGlobals from 'rollup-plugin-external-globals';
19+
import svg from 'rollup-plugin-svg';
1820

1921
const excludeCoverage = [
2022
'test/**',
@@ -151,6 +153,7 @@ export default cliargs => [
151153
primedExternalGlobals,
152154
primedCjs,
153155
primedBabel,
156+
svg(),
154157
cliargs.progress !== false ? progress() : {}
155158
],
156159
onwarn,
@@ -176,6 +179,7 @@ export default cliargs => [
176179
primedExternalGlobals,
177180
primedCjs,
178181
primedBabel,
182+
svg(),
179183
cliargs.progress !== false ? progress() : {}
180184
],
181185
onwarn,
@@ -201,6 +205,7 @@ export default cliargs => [
201205
primedCjs,
202206
CI_TEST_TYPE === 'coverage' ? istanbul({exclude: excludeCoverage}) : {},
203207
primedBabel,
208+
image(),
204209
cliargs.progress !== false ? progress() : {}
205210

206211
],
@@ -238,6 +243,7 @@ export default cliargs => [
238243
}),
239244
json(),
240245
primedBabel,
246+
svg(),
241247
cliargs.progress !== false ? progress() : {}
242248
],
243249
onwarn,
@@ -264,6 +270,7 @@ export default cliargs => [
264270
primedExternalGlobals,
265271
primedCjs,
266272
primedBabel,
273+
svg(),
267274
cliargs.progress !== false ? progress() : {}
268275
],
269276
onwarn,
@@ -289,6 +296,7 @@ export default cliargs => [
289296
plugins: [
290297
json(),
291298
primedBabel,
299+
svg(),
292300
cliargs.progress !== false ? progress() : {}
293301
],
294302
onwarn,
@@ -311,6 +319,7 @@ export default cliargs => [
311319
primedExternalGlobals,
312320
primedCjs,
313321
primedBabel,
322+
svg(),
314323
cliargs.progress !== false ? progress() : {}
315324
],
316325
onwarn,
@@ -334,6 +343,7 @@ export default cliargs => [
334343
primedExternalGlobals,
335344
primedCjs,
336345
primedBabel,
346+
svg(),
337347
cliargs.progress !== false ? progress() : {}
338348
],
339349
onwarn,
+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8" />
5+
<title>Video.js Sandbox</title>
6+
<link href="../dist/video-js.css" rel="stylesheet" type="text/css">
7+
<script src="../dist/video.js"></script>
8+
</head>
9+
<body>
10+
<div style="background-color:#eee; border: 1px solid #777; padding: 10px; margin-bottom: 20px; font-size: .8em; line-height: 1.5em; font-family: Verdana, sans-serif;">
11+
<p>You can use /sandbox/ for writing and testing your own code. Nothing in /sandbox/ will get checked into the repo, except files that end in .example (so don't edit or add those files). To get started run `npm start` and open the svg-icons-enabled.html</p>
12+
<pre>npm start</pre>
13+
<pre>open http://localhost:9999/sandbox/svg-icons-enabled.html</pre>
14+
</div>
15+
16+
<video-js
17+
id="vid1"
18+
controls
19+
preload="auto"
20+
width="640"
21+
height="264"
22+
poster="https://vjs.zencdn.net/v/oceans.png">
23+
<source src="https://vjs.zencdn.net/v/oceans.mp4" type="video/mp4">
24+
<source src="https://vjs.zencdn.net/v/oceans.webm" type="video/webm">
25+
<source src="https://vjs.zencdn.net/v/oceans.ogv" type="video/ogg">
26+
<track kind="captions" src="../docs/examples/shared/example-captions.vtt" srclang="en" label="English">
27+
<p class="vjs-no-js">To view this video please enable JavaScript, and consider upgrading to a web browser that <a href="https://videojs.com/html5-video-support/" target="_blank">supports HTML5 video</a></p>
28+
</video-js>
29+
30+
<script>
31+
var vid = document.getElementById('vid1');
32+
var player = videojs(vid, {experimentalSvgIcons: true});
33+
</script>
34+
35+
</body>
36+
</html>

0 commit comments

Comments
 (0)