From 7370e1546083cb7e603208034e69d869218f343e Mon Sep 17 00:00:00 2001 From: Grzegorz Blaszczyk Date: Tue, 4 Oct 2022 21:29:25 +0200 Subject: [PATCH] feat: add support for a list of quality levels (#7897) This brings the videojs-contrib-quality-levels plugin into Video.js as a feature. --- index.html | 1 + package-lock.json | 9 +++ package.json | 1 + rollup.config.js | 1 + sandbox/quality-levels.html.example | 109 ++++++++++++++++++++++++++++ src/js/debug.js | 1 + src/js/index.js | 1 + 7 files changed, 123 insertions(+) create mode 100644 sandbox/quality-levels.html.example diff --git a/index.html b/index.html index 901ba6e0ac..9a5cbe77d5 100644 --- a/index.html +++ b/index.html @@ -24,6 +24,7 @@

Navigation

  • Language Demo
  • loadMedia Demo
  • Hls Demo
  • +
  • QualityLevels Demo
  • Autoplay Tests
  • noUITitleAttributes Demo
  • Videojs debug build test page
  • diff --git a/package-lock.json b/package-lock.json index b93a40ac63..b1b11dc4d9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16104,6 +16104,15 @@ } } }, + "videojs-contrib-quality-levels": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/videojs-contrib-quality-levels/-/videojs-contrib-quality-levels-2.2.0.tgz", + "integrity": "sha512-r4LFNhjyeBmlGk4Ul43xl+f7sNJ9vFyM6p4NcZNbPlvs1IvykEXCqxvsvaR6KTBjHoHGJnr26grXWcJiLFP+cA==", + "requires": { + "global": "^4.3.2", + "video.js": "^6 || ^7" + } + }, "videojs-font": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/videojs-font/-/videojs-font-3.2.0.tgz", diff --git a/package.json b/package.json index 801b374d1c..d611b36fe8 100644 --- a/package.json +++ b/package.json @@ -94,6 +94,7 @@ "mpd-parser": "1.0.0", "mux.js": "6.2.0", "safe-json-parse": "4.0.0", + "videojs-contrib-quality-levels": "^2.2.0", "videojs-font": "3.2.0", "videojs-vtt.js": "^0.15.3" }, diff --git a/rollup.config.js b/rollup.config.js index f64c498d8a..aa53f26c8e 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -227,6 +227,7 @@ export default cliargs => [ plugins: [ alias({ 'video.js': path.resolve(__dirname, './src/js/video.js'), + 'videojs-contrib-quality-levels': path.resolve(__dirname, './node_modules/videojs-contrib-quality-levels/dist/videojs-contrib-quality-levels.es.js'), '@videojs/http-streaming': path.resolve(__dirname, './node_modules/@videojs/http-streaming/dist/videojs-http-streaming.es.js') }), replace({ diff --git a/sandbox/quality-levels.html.example b/sandbox/quality-levels.html.example new file mode 100644 index 0000000000..7716428b41 --- /dev/null +++ b/sandbox/quality-levels.html.example @@ -0,0 +1,109 @@ + + + + + Video.js Sandbox + + + + + +
    +

    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 make a copy of + index.html.example and rename it to index.html.

    +
    cp sandbox/index.html.example sandbox/index.html
    +
    npm run start
    +
    open http://localhost:9999/sandbox/index.html
    +
    +
    + + +

    To view this video please enable JavaScript, and consider upgrading to a web browser that supports HTML5 video

    +
    +
    +
    + +
    + + + diff --git a/src/js/debug.js b/src/js/debug.js index 91a9423c6b..d4bb122edf 100644 --- a/src/js/debug.js +++ b/src/js/debug.js @@ -1,4 +1,5 @@ import videojs from './video'; +import 'videojs-contrib-quality-levels'; import '@videojs/http-streaming'; import DomData from './utils/dom-data.js'; diff --git a/src/js/index.js b/src/js/index.js index d9114a30c9..77eaf30cba 100644 --- a/src/js/index.js +++ b/src/js/index.js @@ -1,3 +1,4 @@ import videojs from './video'; +import 'videojs-contrib-quality-levels'; import '@videojs/http-streaming'; export default videojs;