mirror of
https://github.com/videojs/video.js.git
synced 2025-01-08 07:00:10 +02:00
Merge branch 'main' into feat-mediasession
This commit is contained in:
commit
4136a53e83
17
CHANGELOG.md
17
CHANGELOG.md
@ -1,3 +1,20 @@
|
||||
<a name="8.4.2"></a>
|
||||
## [8.4.2](https://github.com/videojs/video.js/compare/v8.4.1...v8.4.2) (2023-06-06)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **loading-spinner:** fix loading spinner responsiveness when default font size is modified ([#8295](https://github.com/videojs/video.js/issues/8295)) ([f075177](https://github.com/videojs/video.js/commit/f075177))
|
||||
* **package:** update videojs-contrib-quality-levels to 4.0.0 to eliminate deprecation warning ([#8303](https://github.com/videojs/video.js/issues/8303)) ([fab8f95](https://github.com/videojs/video.js/commit/fab8f95))
|
||||
* **shadow-dom:** prevent warning 'element supplied is not included' ([#8192](https://github.com/videojs/video.js/issues/8192)) ([dc1e2bb](https://github.com/videojs/video.js/commit/dc1e2bb))
|
||||
* **text-track-settings:** fix text track settings responsiveness when default font size is modified ([#8294](https://github.com/videojs/video.js/issues/8294)) ([3dece50](https://github.com/videojs/video.js/commit/3dece50))
|
||||
|
||||
<a name="8.4.1"></a>
|
||||
## [8.4.1](https://github.com/videojs/video.js/compare/v8.4.0...v8.4.1) (2023-06-05)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* revert resolveJsonModule in tsconfig ([#8310](https://github.com/videojs/video.js/issues/8310)) ([8f32b9f](https://github.com/videojs/video.js/commit/8f32b9f))
|
||||
|
||||
<a name="8.4.0"></a>
|
||||
# [8.4.0](https://github.com/videojs/video.js/compare/v8.3.0...v8.4.0) (2023-06-02)
|
||||
|
||||
|
16
package-lock.json
generated
16
package-lock.json
generated
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "video.js",
|
||||
"version": "8.4.0",
|
||||
"version": "8.4.2",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
@ -15224,13 +15224,21 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"videojs-contrib-quality-levels": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/videojs-contrib-quality-levels/-/videojs-contrib-quality-levels-3.0.0.tgz",
|
||||
"integrity": "sha512-sNx38EYUx+Q+gmup1gVTv9P9/sPs28rM7gZOx1sedaHoKxEdYB+ysOGfHj6MSELBMNGMj6ZspdrpSiWguGvGxA==",
|
||||
"requires": {
|
||||
"global": "^4.4.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"videojs-contrib-quality-levels": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/videojs-contrib-quality-levels/-/videojs-contrib-quality-levels-3.0.0.tgz",
|
||||
"integrity": "sha512-sNx38EYUx+Q+gmup1gVTv9P9/sPs28rM7gZOx1sedaHoKxEdYB+ysOGfHj6MSELBMNGMj6ZspdrpSiWguGvGxA==",
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/videojs-contrib-quality-levels/-/videojs-contrib-quality-levels-4.0.0.tgz",
|
||||
"integrity": "sha512-u5rmd8BjLwANp7XwuQ0Q/me34bMe6zg9PQdHfTS7aXgiVRbNTb4djcmfG7aeSrkpZjg+XCLezFNenlJaCjBHKw==",
|
||||
"requires": {
|
||||
"global": "^4.4.0"
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "video.js",
|
||||
"description": "An HTML5 video player that supports HLS and DASH with a common API and skin.",
|
||||
"version": "8.4.0",
|
||||
"version": "8.4.2",
|
||||
"main": "./dist/video.cjs.js",
|
||||
"module": "./dist/video.es.js",
|
||||
"style": "./dist/video-js.css",
|
||||
@ -52,7 +52,7 @@
|
||||
"minify:css:cdn": "cleancss dist/alt/video-js-cdn.css -o dist/alt/video-js-cdn.min.css",
|
||||
"minify:css:default": "cleancss dist/video-js.css -o dist/video-js.min.css",
|
||||
"watch": "npm-run-all -p watch:*",
|
||||
"watch:lang": "chokidar --initial 'lang/**/!(zh-Hans|zh-Hant)*.json' -c 'npm run build:lang'",
|
||||
"watch:lang": "chokidar --initial \"lang/**/!(zh-Hans|zh-Hant)*.json\" -c \"npm run build:lang\"",
|
||||
"watch:rollup": "rollup -c -w --no-progress",
|
||||
"watch:types": "tsc -w",
|
||||
"watch:css": "npm-run-all -p build:css:default build:css:cdn watch:css:*",
|
||||
@ -96,7 +96,7 @@
|
||||
"mpd-parser": "^1.0.1",
|
||||
"mux.js": "^6.2.0",
|
||||
"safe-json-parse": "4.0.0",
|
||||
"videojs-contrib-quality-levels": "3.0.0",
|
||||
"videojs-contrib-quality-levels": "4.0.0",
|
||||
"videojs-font": "4.1.0",
|
||||
"videojs-vtt.js": "0.15.4"
|
||||
},
|
||||
|
79
sandbox/shadow-dom.html.example
Normal file
79
sandbox/shadow-dom.html.example
Normal file
@ -0,0 +1,79 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>Video.js Sandbox</title>
|
||||
<link href="../dist/video-js.css" rel="stylesheet" type="text/css">
|
||||
<script src="../dist/video.js"></script>
|
||||
<link rel="icon" href="data:;base64,=">
|
||||
</head>
|
||||
<body>
|
||||
<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;">
|
||||
<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 index.html</p>
|
||||
<pre>npm start</pre>
|
||||
<pre>open http://localhost:9999/sandbox/index.html</pre>
|
||||
</div>
|
||||
|
||||
<p>Tap on video to play/pause</p>
|
||||
|
||||
<test-custom-element id="customElement1"></test-custom-element>
|
||||
|
||||
<script>
|
||||
// Custom Element definition
|
||||
class TestCustomElement extends HTMLElement {
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
const shadowRoot = this.attachShadow({ mode: 'closed' });
|
||||
|
||||
const styleLinkElem = document.createElement('link');
|
||||
|
||||
styleLinkElem.setAttribute('rel', 'stylesheet');
|
||||
styleLinkElem.setAttribute('href', '../dist/video-js.css')
|
||||
shadowRoot.append(styleLinkElem);
|
||||
|
||||
const containerElem = document.createElement('div');
|
||||
|
||||
containerElem.setAttribute('data-vjs-player', '');
|
||||
shadowRoot.appendChild(containerElem);
|
||||
|
||||
const videoElem = document.createElement('video');
|
||||
|
||||
videoElem.setAttribute('preload', 'auto');
|
||||
videoElem.setAttribute('width', 640);
|
||||
videoElem.setAttribute('height', 260);
|
||||
containerElem.appendChild(videoElem);
|
||||
|
||||
const sourceElem = document.createElement('source');
|
||||
|
||||
sourceElem.setAttribute('src', 'https://vjs.zencdn.net/v/oceans.mp4');
|
||||
sourceElem.setAttribute('type', 'video/mp4');
|
||||
videoElem.appendChild(sourceElem);
|
||||
|
||||
this.innerPlayer = videojs(videoElem);
|
||||
|
||||
containerElem.addEventListener('click', () => {
|
||||
if (this.innerPlayer.paused()) {
|
||||
this.innerPlayer.play();
|
||||
}
|
||||
else {
|
||||
this.innerPlayer.pause();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
window.customElements.define('test-custom-element', TestCustomElement);
|
||||
|
||||
// Main entry point
|
||||
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
var customElem = document.getElementById('customElement1');
|
||||
var innerPlayer = customElem.innerPlayer;
|
||||
innerPlayer.log('Shadow DOM inner player created', innerPlayer);
|
||||
});
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -53,6 +53,10 @@
|
||||
}
|
||||
|
||||
// Form elements
|
||||
.vjs-text-track-settings select {
|
||||
font-size: inherit;
|
||||
}
|
||||
|
||||
.vjs-track-setting > select {
|
||||
margin-right: 1em;
|
||||
margin-bottom: 0.5em;
|
||||
@ -65,7 +69,7 @@
|
||||
|
||||
.vjs-text-track-settings fieldset span {
|
||||
display: inline-block;
|
||||
padding: 0 6px 8px;
|
||||
padding: 0 .6em .8em;
|
||||
}
|
||||
|
||||
// style the second select for text colors
|
||||
@ -76,17 +80,11 @@
|
||||
.vjs-text-track-settings legend {
|
||||
color: $primary-foreground-color;
|
||||
font-weight: bold;
|
||||
font-size: 14px;
|
||||
font-size: 1.2em;
|
||||
}
|
||||
|
||||
.vjs-text-track-settings .vjs-label {
|
||||
clip: rect(1px 1px 1px 1px); // for Internet Explorer
|
||||
clip: rect(1px, 1px, 1px, 1px);
|
||||
margin: 0 5px 5px 0;
|
||||
border: 0;
|
||||
height: 1px;
|
||||
width: 1px;
|
||||
overflow: hidden;
|
||||
margin: 0 .5em .5em 0;
|
||||
}
|
||||
|
||||
.vjs-track-settings-controls button:focus,
|
||||
|
@ -3,20 +3,20 @@
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
margin: -25px 0 0 -25px;
|
||||
transform: translate(-50%, -50%);
|
||||
opacity: 0.85;
|
||||
|
||||
// Need to fix centered page layouts
|
||||
text-align: left;
|
||||
|
||||
border: 6px solid rgba($primary-background-color, $primary-background-transparency);
|
||||
border: .6em solid rgba($primary-background-color, $primary-background-transparency);
|
||||
// border: 6px solid rgba(43, 51, 63, 0.5);
|
||||
|
||||
box-sizing: border-box;
|
||||
background-clip: padding-box;
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
border-radius: 25px;
|
||||
width: 5em;
|
||||
height: 5em;
|
||||
border-radius: 50%;
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
@ -31,7 +31,7 @@
|
||||
.vjs-loading-spinner:after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
margin: -6px;
|
||||
margin: -0.6em;
|
||||
box-sizing: inherit;
|
||||
width: inherit;
|
||||
height: inherit;
|
||||
|
@ -149,7 +149,12 @@ function videojs(id, options, ready) {
|
||||
// This will make sure that the element is indeed in the dom of that document.
|
||||
// Additionally, check that the document in question has a default view.
|
||||
// If the document is no longer attached to the dom, the defaultView of the document will be null.
|
||||
if (!el.ownerDocument.defaultView || !el.ownerDocument.body.contains(el)) {
|
||||
// If element is inside Shadow DOM (e.g. is part of a Custom element), ownerDocument.body
|
||||
// always returns false. Instead, use the Shadow DOM root.
|
||||
const inShadowDom = el.getRootNode() instanceof window.ShadowRoot;
|
||||
const rootNode = inShadowDom ? el.getRootNode() : el.ownerDocument.body;
|
||||
|
||||
if (!el.ownerDocument.defaultView || !rootNode.contains(el)) {
|
||||
log.warn('The element supplied is not included in the DOM');
|
||||
}
|
||||
|
||||
|
26
test/unit/utils/custom-element.test.js
Normal file
26
test/unit/utils/custom-element.test.js
Normal file
@ -0,0 +1,26 @@
|
||||
/* eslint-env browser */
|
||||
import videojs from '../../../src/js/video.js';
|
||||
|
||||
export class TestCustomElement extends HTMLElement {
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
const shadowRoot = this.attachShadow({ mode: 'closed' });
|
||||
|
||||
const containerElem = document.createElement('div');
|
||||
|
||||
containerElem.setAttribute('data-vjs-player', '');
|
||||
shadowRoot.appendChild(containerElem);
|
||||
|
||||
const videoElem = document.createElement('video');
|
||||
|
||||
videoElem.setAttribute('width', 640);
|
||||
videoElem.setAttribute('height', 260);
|
||||
containerElem.appendChild(videoElem);
|
||||
|
||||
this.innerPlayer = videojs(videoElem);
|
||||
}
|
||||
}
|
||||
|
||||
window.customElements.define('test-custom-element', TestCustomElement);
|
@ -4,6 +4,8 @@ import * as Dom from '../../src/js/utils/dom.js';
|
||||
import log from '../../src/js/utils/log.js';
|
||||
import document from 'global/document';
|
||||
import sinon from 'sinon';
|
||||
// import custom element for Shadow DOM test
|
||||
import './utils/custom-element.test';
|
||||
|
||||
QUnit.module('video.js', {
|
||||
beforeEach() {
|
||||
@ -84,6 +86,29 @@ QUnit.test(
|
||||
}
|
||||
);
|
||||
|
||||
QUnit.test(
|
||||
'should not log if the supplied element is included in the Shadow DOM',
|
||||
function(assert) {
|
||||
const origWarnLog = log.warn;
|
||||
const fixture = document.getElementById('qunit-fixture');
|
||||
const warnLogs = [];
|
||||
|
||||
log.warn = (args) => {
|
||||
warnLogs.push(args);
|
||||
};
|
||||
|
||||
const customElem = document.createElement('test-custom-element');
|
||||
|
||||
fixture.appendChild(customElem);
|
||||
const innerPlayer = customElem.innerPlayer;
|
||||
|
||||
assert.ok(innerPlayer, 'created player within Shadow DOM');
|
||||
assert.equal(warnLogs.length, 0, 'no warn logs');
|
||||
|
||||
log.warn = origWarnLog;
|
||||
}
|
||||
);
|
||||
|
||||
QUnit.test(
|
||||
'should log about already initialized players if options already passed',
|
||||
function(assert) {
|
||||
|
@ -8,7 +8,6 @@
|
||||
"declarationMap": true,
|
||||
"skipLibCheck": true,
|
||||
"checkJs": false,
|
||||
"preserveWatchOutput": true,
|
||||
"resolveJsonModule": true
|
||||
"preserveWatchOutput": true
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user