shaka-video-element 0.6.6 → 0.6.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/shaka-video-element.js +30 -7
- package/package.json +2 -2
|
@@ -25954,12 +25954,13 @@ var CustomMediaMixin = (superclass, { tag, is }) => {
|
|
|
25954
25954
|
#isInit;
|
|
25955
25955
|
#nativeEl;
|
|
25956
25956
|
#childMap = /* @__PURE__ */ new Map();
|
|
25957
|
+
#childObserver;
|
|
25957
25958
|
constructor() {
|
|
25958
25959
|
super();
|
|
25959
25960
|
}
|
|
25960
25961
|
get nativeEl() {
|
|
25961
25962
|
this.#init();
|
|
25962
|
-
return this.#nativeEl ?? this.
|
|
25963
|
+
return this.#nativeEl ?? this.querySelector(":scope > [slot=media]") ?? this.querySelector(tag) ?? this.shadowRoot.querySelector(tag);
|
|
25963
25964
|
}
|
|
25964
25965
|
set nativeEl(val) {
|
|
25965
25966
|
this.#nativeEl = val;
|
|
@@ -25999,6 +26000,7 @@ var CustomMediaMixin = (superclass, { tag, is }) => {
|
|
|
25999
26000
|
for (let prop of nativeElProps) {
|
|
26000
26001
|
this.#upgradeProperty(prop);
|
|
26001
26002
|
}
|
|
26003
|
+
this.#childObserver = new MutationObserver(this.#syncMediaChildAttribute);
|
|
26002
26004
|
this.shadowRoot.addEventListener("slotchange", this);
|
|
26003
26005
|
this.#syncMediaChildren();
|
|
26004
26006
|
for (let type of this.constructor.Events) {
|
|
@@ -26027,13 +26029,30 @@ var CustomMediaMixin = (superclass, { tag, is }) => {
|
|
|
26027
26029
|
if (!clone) {
|
|
26028
26030
|
clone = el.cloneNode();
|
|
26029
26031
|
this.#childMap.set(el, clone);
|
|
26032
|
+
this.#childObserver.observe(el, { attributes: true });
|
|
26030
26033
|
}
|
|
26031
26034
|
this.nativeEl.append?.(clone);
|
|
26032
|
-
|
|
26033
|
-
|
|
26034
|
-
|
|
26035
|
+
this.#enableDefaultTrack(clone);
|
|
26036
|
+
});
|
|
26037
|
+
removeNativeChildren.forEach((clone, el) => {
|
|
26038
|
+
clone.remove();
|
|
26039
|
+
this.#childMap.delete(el);
|
|
26035
26040
|
});
|
|
26036
|
-
|
|
26041
|
+
}
|
|
26042
|
+
#syncMediaChildAttribute = (mutations) => {
|
|
26043
|
+
for (let mutation of mutations) {
|
|
26044
|
+
if (mutation.type === "attributes") {
|
|
26045
|
+
const { target, attributeName } = mutation;
|
|
26046
|
+
const clone = this.#childMap.get(target);
|
|
26047
|
+
clone?.setAttribute(attributeName, target.getAttribute(attributeName));
|
|
26048
|
+
this.#enableDefaultTrack(clone);
|
|
26049
|
+
}
|
|
26050
|
+
}
|
|
26051
|
+
};
|
|
26052
|
+
#enableDefaultTrack(trackEl) {
|
|
26053
|
+
if (trackEl.localName === "track" && trackEl.default && (trackEl.kind === "chapters" || trackEl.kind === "metadata") && trackEl.track.mode === "disabled") {
|
|
26054
|
+
trackEl.track.mode = "hidden";
|
|
26055
|
+
}
|
|
26037
26056
|
}
|
|
26038
26057
|
#upgradeProperty(prop) {
|
|
26039
26058
|
if (Object.prototype.hasOwnProperty.call(this, prop)) {
|
|
@@ -26090,9 +26109,13 @@ function namedNodeMapToObject(namedNodeMap) {
|
|
|
26090
26109
|
return obj;
|
|
26091
26110
|
}
|
|
26092
26111
|
var CustomVideoElement = CustomMediaMixin(globalThis.HTMLElement ?? class {
|
|
26093
|
-
}, {
|
|
26112
|
+
}, {
|
|
26113
|
+
tag: "video"
|
|
26114
|
+
});
|
|
26094
26115
|
var CustomAudioElement = CustomMediaMixin(globalThis.HTMLElement ?? class {
|
|
26095
|
-
}, {
|
|
26116
|
+
}, {
|
|
26117
|
+
tag: "audio"
|
|
26118
|
+
});
|
|
26096
26119
|
|
|
26097
26120
|
// shaka-video-element.js
|
|
26098
26121
|
var import_shaka_player = __toESM(require_shaka_player_compiled(), 1);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "shaka-video-element",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.7",
|
|
4
4
|
"description": "Custom element (web component) for Shaka Player",
|
|
5
5
|
"author": "@muxinc",
|
|
6
6
|
"license": "MIT",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"build": "run-s build:*"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"custom-media-element": "^1.3.
|
|
33
|
+
"custom-media-element": "^1.3.3",
|
|
34
34
|
"shaka-player": "~4.8.4"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|