@mattebox/player-preferences 0.0.0-stage → 0.1.0
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/LICENSE +21 -0
- package/README.md +43 -2
- package/dist/cdn/mattebox-player-preferences.min.js +1 -0
- package/dist/component.d.ts +31 -0
- package/dist/component.d.ts.map +1 -0
- package/dist/component.js +49 -0
- package/dist/component.js.map +1 -0
- package/dist/element.d.ts +39 -0
- package/dist/element.d.ts.map +1 -0
- package/dist/element.js +261 -0
- package/dist/element.js.map +1 -0
- package/dist/es2015/_virtual/_@oxc-project_runtime@0.155.0/helpers/esm/defineProperty.js +11 -0
- package/dist/es2015/_virtual/_@oxc-project_runtime@0.155.0/helpers/esm/objectSpread2.js +24 -0
- package/dist/es2015/_virtual/_@oxc-project_runtime@0.155.0/helpers/esm/toPrimitive.js +13 -0
- package/dist/es2015/_virtual/_@oxc-project_runtime@0.155.0/helpers/esm/toPropertyKey.js +8 -0
- package/dist/es2015/_virtual/_@oxc-project_runtime@0.155.0/helpers/esm/typeof.js +10 -0
- package/dist/es2015/component.js +43 -0
- package/dist/es2015/element.js +223 -0
- package/dist/es2015/host.js +18 -0
- package/dist/es2015/index.js +18 -0
- package/dist/es2015/store.js +70 -0
- package/dist/es2015/tracks.js +45 -0
- package/dist/host.d.ts +14 -0
- package/dist/host.d.ts.map +1 -0
- package/dist/host.js +19 -0
- package/dist/host.js.map +1 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +19 -0
- package/dist/index.js.map +1 -0
- package/dist/store.d.ts +62 -0
- package/dist/store.d.ts.map +1 -0
- package/dist/store.js +89 -0
- package/dist/store.js.map +1 -0
- package/dist/tracks.d.ts +21 -0
- package/dist/tracks.d.ts.map +1 -0
- package/dist/tracks.js +47 -0
- package/dist/tracks.js.map +1 -0
- package/package.json +56 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Josep Boix Requesens
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,44 @@
|
|
|
1
|
-
|
|
1
|
+
<h1>
|
|
2
|
+
<img src="https://raw.githubusercontent.com/jboix/mattebox-player/main/docs/logo.svg" width="44" height="44" align="absmiddle" alt="">
|
|
3
|
+
@mattebox/player-preferences
|
|
4
|
+
</h1>
|
|
2
5
|
|
|
3
|
-
|
|
6
|
+
The viewer's preferences for the
|
|
7
|
+
[Mattebox player](https://github.com/jboix/mattebox-player).
|
|
8
|
+
|
|
9
|
+
- `<mbx-preferences>` keeps the audio and subtitle tracks, the volume, the mute, the rate, the quality and the subtitle look.
|
|
10
|
+
- It puts them back at each load, by language and kind.
|
|
11
|
+
- `preferences()` is a store that every player and element of the page share. Your own elements add typed keys to it.
|
|
12
|
+
- Without `storage-key`, nothing is written to storage.
|
|
13
|
+
|
|
14
|
+
```sh
|
|
15
|
+
npm install @mattebox/player-preferences @mattebox/player mattebox
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
```html
|
|
19
|
+
<mattebox-player src="https://example.com/vod/master.m3u8" controls="custom">
|
|
20
|
+
<mbx-preferences storage-key="my-site"></mbx-preferences>
|
|
21
|
+
<mbx-control-bar>
|
|
22
|
+
<mbx-play-button></mbx-play-button>
|
|
23
|
+
<mbx-audio-menu></mbx-audio-menu>
|
|
24
|
+
<mbx-subtitles-menu></mbx-subtitles-menu>
|
|
25
|
+
</mbx-control-bar>
|
|
26
|
+
</mattebox-player>
|
|
27
|
+
|
|
28
|
+
<script type="module">
|
|
29
|
+
import '@mattebox/player';
|
|
30
|
+
import '@mattebox/player-preferences';
|
|
31
|
+
</script>
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
| Attribute | What it does |
|
|
35
|
+
| ------------- | ---------------------------------------------------------------------------------- |
|
|
36
|
+
| `storage-key` | Stores the choices in localStorage under this key. Without it, they stay in memory |
|
|
37
|
+
| `except` | The keys the element leaves alone, such as `except="rate quality"` |
|
|
38
|
+
|
|
39
|
+
The [player guide](https://github.com/jboix/mattebox-player/blob/main/docs/guide/08-preferences.md)
|
|
40
|
+
explains the store and your own keys.
|
|
41
|
+
|
|
42
|
+
## License
|
|
43
|
+
|
|
44
|
+
MIT
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var matteboxPlayerPreferences=(function(e,t){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function n(e){let t=e.parentNode;return t===null?e instanceof ShadowRoot?e.host:null:t}function r(e){let t=e;for(;t!==null;){if(t instanceof HTMLElement&&t.localName===`mattebox-player`)return t;t=n(t)}return null}var i=class extends HTMLElement{constructor(){super(),this.player=null,this.offs=[],this.epoch=0}connectedCallback(){let e=r(this);if(e===null)return;this.epoch+=1;let t=this.epoch,n=()=>{t===this.epoch&&this.isConnected&&(customElements.upgrade(e),`video`in e&&(this.player=e,this.attach(this.player)))};`video`in e?n():customElements.whenDefined(`mattebox-player`).then(n)}disconnectedCallback(){this.epoch+=1;for(let e of this.offs)e();this.offs=[],this.player=null}on(e,t,n,r){e.addEventListener(t,n,r),this.offs.push(()=>{e.removeEventListener(t,n,r)})}keep(e){this.offs.push(e)}};function a(e){"@babel/helpers - typeof";return a=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},a(e)}function o(e,t){if(a(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(a(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function s(e){var t=o(e,`string`);return a(t)==`symbol`?t:t+``}function c(e,t,n){return(t=s(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function u(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?l(Object(n),!0).forEach(function(t){c(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):l(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}let d=/* @__PURE__ */ new Map;function f(e,t){try{var n;let r=JSON.parse((n=e==null?void 0:e.getItem(t))==null?`null`:n);return(r==null?void 0:r.version)===1&&typeof r.values==`object`&&r.values!==null?r.values:{}}catch(e){return{}}}function p(){try{return window.localStorage}catch(e){return null}}function m(e={}){var t,n;let r=(t=e.key)==null?``:t,i=d.get(r);if(i!==void 0)return i;let a=r===``?null:(n=e.storage)==null?p():n,o=f(a,r),s=/* @__PURE__ */ new Map,c=e=>{var t;for(let n of(t=s.get(e))==null?[]:t)n(o[e])};a!==null&&typeof window<`u`&&window.addEventListener(`storage`,e=>{if(e.key!==r||e.storageArea!==a)return;let t=o;o=f(a,r);for(let e of/* @__PURE__ */ new Set([...Object.keys(t),...Object.keys(o)]))JSON.stringify(t[e])!==JSON.stringify(o[e])&&c(e)});let l={get:e=>o[e],set(e,t){if(JSON.stringify(o[e])!==JSON.stringify(t)){o=u({},o),t===void 0?delete o[e]:o[e]=t;try{a==null||a.setItem(r,JSON.stringify({version:1,values:o}))}catch(e){}c(e)}},on(e,t){var n;let r=(n=s.get(e))==null?/* @__PURE__ */ new Set:n;return s.set(e,r),r.add(t),()=>{r.delete(t)}}};return d.set(r,l),l}let h=[`description`,`enhanced-speech`];function g(e){return e.toLowerCase().split(`-`)[0]}function _(e,t){let n=t.language!==``&&g(e.language)===g(t.language),r=e.kind===t.kind;return n?r?3:2:r&&h.includes(t.kind)?1:0}function v(e,t,n=-1){let r=-1,i=0;return e.forEach((e,a)=>{let o=_(e,t);(o>i||o===i&&o>0&&a===n)&&(r=a,i=o)}),r}function y(e){var n;let r=e.contentType===`text`?(0,t.isSdh)(e)?`captions`:`subtitles`:(0,t.isAudioDescription)(e)?`description`:(0,t.isEnhancedSpeech)(e)?`enhanced-speech`:`main`;return{language:(n=e.lang)==null?``:n,kind:r}}function b(e){let t=e.kind===`main-desc`?`description`:e.kind||`main`;return{language:e.language,kind:t}}let x=`subtitle-size`,S=`subtitle-background`,C=(e,t)=>JSON.stringify(e)===JSON.stringify(t);var w=class extends i{static get observedAttributes(){return[`storage-key`]}constructor(){super(),this.store=m(),this.engine=null,this.put={},this.pinned=null,this.loading=!0,this.offEngine=null,this.saved=/* @__PURE__ */ new Set}attributeChangedCallback(){let e=this.getAttribute(`storage-key`),t=m(e===null?{}:{key:e});if(t!==this.store){for(let e of this.saved)t.set(e,this.store.get(e));this.saved=/* @__PURE__ */ new Set,this.store=t}}keeps(e){var t;return!((t=this.getAttribute(`except`))==null?``:t).split(/\s+/).includes(e)}stored(e){return this.keeps(e)?this.store.get(e):void 0}save(e,t){this.keeps(e)&&(this.store.set(e,t),this.saved.add(e))}attach(e){let t=e.video,n=this.stored(`volume`);n!==void 0&&(t.volume=n);let r=e.hasAttribute(`muted`),i=this.stored(`muted`);i!==void 0&&!r&&(t.muted=i);let a=this.stored(`subtitle-look`);(a==null?void 0:a.size)!==void 0&&e.setAttribute(x,a.size),(a==null?void 0:a.background)!==void 0&&e.setAttribute(S,a.background),this.on(t,`volumechange`,()=>{this.save(`volume`,t.volume),r=r&&t.muted,r||this.save(`muted`,t.muted)});let o=new MutationObserver(()=>{let t=e.getAttribute(x),n=e.getAttribute(S);this.save(`subtitle-look`,u(u({},t===null?{}:{size:t}),n===null?{}:{background:n}))});o.observe(e,{attributes:!0,attributeFilter:[x,S]}),this.keep(()=>{o.disconnect()}),this.on(t,`loadstart`,()=>{this.loading=!0,this.put={}}),this.on(t,`loadedmetadata`,()=>{let n=this.stored(`rate`);n!==void 0&&(t.playbackRate=n),this.loading=!1,this.engine===null&&this.restoreNative(e)}),this.on(t,`ratechange`,()=>{var e,n;let r=(e=this.engine)==null?{}:e,i=r.trick,a=((n=r.live)==null?void 0:n.edge)!=null||t.duration===1/0;this.loading||a||i!==void 0&&(i.rate!==1||i.scrubbing)||this.save(`rate`,t.playbackRate)}),this.on(e,`click`,()=>{setTimeout(()=>{this.notePin()},0)});for(let n of[`audioTracks`,`textTracks`]){let r=t[n];r!==void 0&&this.on(r,`change`,()=>this.noteNative(e))}this.on(e,`sourcechange`,()=>{this.follow(e.engine)}),this.follow(e.engine),this.keep(()=>{this.follow(null)})}follow(e){var t;if((t=this.offEngine)==null||t.call(this),this.offEngine=null,this.engine=e,e===null)return;let n=()=>void 0,r=()=>void 0,i=()=>{n(),this.restoreEngine(e),r=e.on(`tracks:selected`,()=>{this.noteEngine(e)})};e.tracks.available.length>0?i():n=e.on(`tracks:changed`,i),this.offEngine=()=>{n(),r()}}restoreEngine(e){let t=e.tracks;for(let i of[`audio`,`subtitles`]){let a=i===`audio`?`audio`:`text`,o=t.available.filter(e=>e.contentType===a&&t.selectable(e.id)&&!e.forced),s=this.stored(i);if(this.put[i]=this.engineActive(e,i),s===null){var n,r;(n=(r=t.active(`text`))==null?void 0:r.forced)!=null&&n||t.deselect(`text`),this.put[i]=null}else if(s!==void 0){let e=t.active(a),n=o[v(o.map(y),s,e===null?-1:o.indexOf(e))];n!==void 0&&(t.select(n.id),this.put[i]=y(n))}}let i=this.stored(`quality`),a=e.quality;if(typeof i==`number`){var o;let e=[...a.selectable].filter(e=>e.height!==void 0).sort((e,t)=>t.height-e.height),t=(o=e.find(e=>e.height<=i))==null?e[e.length-1]:o;if(t!==void 0){a.pin(t.id),this.pinned=t.id;return}}this.pinned=a.pinned}engineActive(e,t){let n=e.tracks.active(t===`audio`?`audio`:`text`);return n===null||n.forced===!0?null:y(n)}noteEngine(e){for(let t of[`audio`,`subtitles`]){let n=this.engineActive(e,t);t===`subtitles`&&n===null&&e.tracks.active(`text`)!==null||t===`audio`&&n===null||C(n,this.put[t])||(this.put[t]=n,this.save(t,n))}}notePin(){var e,t;let n=(e=this.engine)==null?void 0:e.quality;if(n===void 0||n.pinned===this.pinned)return;this.pinned=n.pinned;let r=(t=n.renditions.find(e=>e.id===this.pinned))==null?void 0:t.height;this.save(`quality`,r==null?null:r)}native(e,t){let n=t===`audio`?`audioTracks`:`textTracks`,r=e.video[n],i=r===void 0?[]:Array.from(r);return t===`audio`?i:i.filter(e=>e.kind===`subtitles`||e.kind===`captions`)}nativeActive(e,t){let n=this.native(e,t).find(e=>t===`audio`?e.enabled===!0:e.mode===`showing`);return n===void 0?null:b(n)}restoreNative(e){for(let t of[`audio`,`subtitles`]){let n=this.native(e,t),r=this.stored(t);if(r!==void 0&&n.length>0){let e=n.map(b),i=r===null?-1:v(e,r);(i!==-1||t===`subtitles`&&r===null)&&n.forEach((e,n)=>{t===`audio`?e.enabled=n===i:e.mode=n===i?`showing`:`disabled`})}this.put[t]=this.nativeActive(e,t)}}noteNative(e){if(!(this.engine!==null||this.loading))for(let t of[`audio`,`subtitles`]){let n=this.nativeActive(e,t);t===`audio`&&n===null||C(n,this.put[t])||(this.put[t]=n,this.save(t,n))}}};let T=`mbx-preferences`;function E(e){var t,n;return(t=(n=e.querySelector(`mbx-preferences`))==null?void 0:n.store)==null?null:t}return customElements.get(`mbx-preferences`)===void 0&&customElements.define(T,w),e.MbxPreferences=w,e.PREFERENCES=T,e.preferences=m,e.preferencesOf=E,e})({},mattebox);
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Finding the player, and letting go of it: the part of the player's own
|
|
3
|
+
* control base this package needs. The player exports no base class, so a
|
|
4
|
+
* control of the page's own, this one included, implements the contract
|
|
5
|
+
* from outside (player guide, chapter 03).
|
|
6
|
+
*
|
|
7
|
+
* The control attaches when it is connected inside a player, once the
|
|
8
|
+
* player is defined and upgraded, and detaches when it is removed. What it
|
|
9
|
+
* adds goes through `keep`, so detaching drops it all.
|
|
10
|
+
*
|
|
11
|
+
* No class fields: the ES2015 build would lower them into helpers, and the
|
|
12
|
+
* emit check bans helpers. State is declared, then assigned in the
|
|
13
|
+
* constructor.
|
|
14
|
+
*/
|
|
15
|
+
import type { PlayerHost } from './host.js';
|
|
16
|
+
export declare abstract class Component extends HTMLElement {
|
|
17
|
+
protected player: PlayerHost | null;
|
|
18
|
+
private offs;
|
|
19
|
+
/** Bumped on every connect and disconnect, so a late upgrade attaches only to the current connection. */
|
|
20
|
+
private epoch;
|
|
21
|
+
constructor();
|
|
22
|
+
connectedCallback(): void;
|
|
23
|
+
disconnectedCallback(): void;
|
|
24
|
+
/** Adds `fn` for `name` on `target`, removed on detach. */
|
|
25
|
+
protected on(target: EventTarget, name: string, fn: (event: Event) => void, options?: AddEventListenerOptions): void;
|
|
26
|
+
/** Runs `off` on detach. */
|
|
27
|
+
protected keep(off: () => void): void;
|
|
28
|
+
/** The control is connected inside an upgraded player. Subscribe. */
|
|
29
|
+
protected abstract attach(player: PlayerHost): void;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=component.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../src/component.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAG5C,8BAAsB,SAAU,SAAQ,WAAW;IACjD,UAAkB,MAAM,EAAE,UAAU,GAAG,IAAI,CAAC;IAC5C,QAAgB,IAAI,CAAoB;IACxC,yGAAyG;IACzG,QAAgB,KAAK,CAAS;;IAS9B,iBAAiB,IAAI,IAAI;IAiBzB,oBAAoB,IAAI,IAAI;IAO5B,2DAA2D;IAC3D,SAAS,CAAC,EAAE,CACV,MAAM,EAAE,WAAW,EACnB,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,EAC1B,OAAO,CAAC,EAAE,uBAAuB,GAChC,IAAI;IAOP,4BAA4B;IAC5B,SAAS,CAAC,IAAI,CAAC,GAAG,EAAE,MAAM,IAAI,GAAG,IAAI;IAIrC,qEAAqE;IACrE,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,UAAU,GAAG,IAAI;CACpD"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { findPlayer, PLAYER } from './host.js';
|
|
2
|
+
export class Component extends HTMLElement {
|
|
3
|
+
constructor() {
|
|
4
|
+
super();
|
|
5
|
+
this.player = null;
|
|
6
|
+
this.offs = [];
|
|
7
|
+
this.epoch = 0;
|
|
8
|
+
}
|
|
9
|
+
connectedCallback() {
|
|
10
|
+
const found = findPlayer(this);
|
|
11
|
+
if (found === null)
|
|
12
|
+
return;
|
|
13
|
+
this.epoch += 1;
|
|
14
|
+
const epoch = this.epoch;
|
|
15
|
+
const attach = () => {
|
|
16
|
+
if (epoch !== this.epoch || !this.isConnected)
|
|
17
|
+
return;
|
|
18
|
+
// Defined, and this instance upgraded: `video` is on the prototype.
|
|
19
|
+
customElements.upgrade(found);
|
|
20
|
+
if (!('video' in found))
|
|
21
|
+
return;
|
|
22
|
+
this.player = found;
|
|
23
|
+
this.attach(this.player);
|
|
24
|
+
};
|
|
25
|
+
if ('video' in found)
|
|
26
|
+
attach();
|
|
27
|
+
else
|
|
28
|
+
void customElements.whenDefined(PLAYER).then(attach);
|
|
29
|
+
}
|
|
30
|
+
disconnectedCallback() {
|
|
31
|
+
this.epoch += 1;
|
|
32
|
+
for (const off of this.offs)
|
|
33
|
+
off();
|
|
34
|
+
this.offs = [];
|
|
35
|
+
this.player = null;
|
|
36
|
+
}
|
|
37
|
+
/** Adds `fn` for `name` on `target`, removed on detach. */
|
|
38
|
+
on(target, name, fn, options) {
|
|
39
|
+
target.addEventListener(name, fn, options);
|
|
40
|
+
this.offs.push(() => {
|
|
41
|
+
target.removeEventListener(name, fn, options);
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
/** Runs `off` on detach. */
|
|
45
|
+
keep(off) {
|
|
46
|
+
this.offs.push(off);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component.js","sourceRoot":"","sources":["../src/component.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAE/C,MAAM,OAAgB,SAAU,SAAQ,WAAW;IAMjD;QACE,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;QACnB,IAAI,CAAC,IAAI,GAAG,EAAE,CAAC;QAC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AAC,IAAI,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC;QAChD,CAAC,CAAC,CAAC;IACL,CAAC;IAED,4BAA4B;IAClB,IAAI,CAAC,GAAe;QAC5B,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACtB,CAAC;CAIF"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Component } from './component.js';
|
|
2
|
+
import type { PlayerHost } from './host.js';
|
|
3
|
+
import type { PreferenceStore } from './store.js';
|
|
4
|
+
export declare class MbxPreferences extends Component {
|
|
5
|
+
static get observedAttributes(): readonly string[];
|
|
6
|
+
/** The store the element reads and writes: the memory one, or the one of `storage-key`. */
|
|
7
|
+
store: PreferenceStore;
|
|
8
|
+
private engine;
|
|
9
|
+
/** The tracks the element put back for this load, which are not the viewer's choice. Absent before. */
|
|
10
|
+
private put;
|
|
11
|
+
/** The pin the element last saw, to tell the viewer's pick. */
|
|
12
|
+
private pinned;
|
|
13
|
+
/** The video loads, and its rate is the reset of the load until the element puts the stored one back. */
|
|
14
|
+
private loading;
|
|
15
|
+
private offEngine;
|
|
16
|
+
/** The keys this element saved in its current store, which go along when `storage-key` changes. */
|
|
17
|
+
private saved;
|
|
18
|
+
constructor();
|
|
19
|
+
attributeChangedCallback(): void;
|
|
20
|
+
/** Whether the element keeps `key`: every key, less the ones `except` names. */
|
|
21
|
+
private keeps;
|
|
22
|
+
/** The stored value of `key`, or undefined when the element leaves it alone. */
|
|
23
|
+
private stored;
|
|
24
|
+
private save;
|
|
25
|
+
protected attach(player: PlayerHost): void;
|
|
26
|
+
/** Puts the stored tracks and pin back on each engine once its manifest lists them, and saves the viewer's changes. */
|
|
27
|
+
private follow;
|
|
28
|
+
private restoreEngine;
|
|
29
|
+
/** The active track of `kind` as a choice: null for subtitles off, or for a forced track. */
|
|
30
|
+
private engineActive;
|
|
31
|
+
private noteEngine;
|
|
32
|
+
private notePin;
|
|
33
|
+
/** The native session's audio and subtitle tracks, as Safari lists them. */
|
|
34
|
+
private native;
|
|
35
|
+
private nativeActive;
|
|
36
|
+
private restoreNative;
|
|
37
|
+
private noteNative;
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=element.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"element.d.ts","sourceRoot":"","sources":["../src/element.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,KAAK,EAAE,eAAe,EAA4B,MAAM,YAAY,CAAC;AA2B5E,qBAAa,cAAe,SAAQ,SAAS;IAC3C,MAAM,KAAK,kBAAkB,IAAI,SAAS,MAAM,EAAE,CAEjD;IAED,2FAA2F;IACnF,KAAK,EAAE,eAAe,CAAC;IAC/B,QAAgB,MAAM,CAAkB;IACxC,uGAAuG;IACvG,QAAgB,GAAG,CAA4C;IAC/D,+DAA+D;IAC/D,QAAgB,MAAM,CAAgB;IACtC,yGAAyG;IACzG,QAAgB,OAAO,CAAU;IACjC,QAAgB,SAAS,CAAsB;IAC/C,mGAAmG;IACnG,QAAgB,KAAK,CAAc;;IAanC,wBAAwB,IAAI,IAAI;IAYhC,gFAAgF;IAChF,OAAO,CAAC,KAAK;IAIb,gFAAgF;IAChF,OAAO,CAAC,MAAM;IAId,OAAO,CAAC,IAAI;IAMZ,SAAS,CAAC,MAAM,CAAC,MAAM,EAAE,UAAU,GAAG,IAAI;IAsE1C,uHAAuH;IACvH,OAAO,CAAC,MAAM;IAsBd,OAAO,CAAC,aAAa;IA8CrB,6FAA6F;IAC7F,OAAO,CAAC,YAAY;IAKpB,OAAO,CAAC,UAAU;IAYlB,OAAO,CAAC,OAAO;IAQf,4EAA4E;IAC5E,OAAO,CAAC,MAAM;IAWd,OAAO,CAAC,YAAY;IAOpB,OAAO,CAAC,aAAa;IAmBrB,OAAO,CAAC,UAAU;CASnB"}
|
package/dist/element.js
ADDED
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
import { Component } from './component.js';
|
|
2
|
+
import { preferences } from './store.js';
|
|
3
|
+
import { best, engineChoice, nativeChoice } from './tracks.js';
|
|
4
|
+
/** The keys the element saves, in the words `except` takes. */
|
|
5
|
+
const KEYS = ['volume', 'muted', 'rate', 'quality', 'audio', 'subtitles', 'subtitle-look'];
|
|
6
|
+
const SIZE = 'subtitle-size';
|
|
7
|
+
const BACKGROUND = 'subtitle-background';
|
|
8
|
+
const same = (a, b) => JSON.stringify(a) === JSON.stringify(b);
|
|
9
|
+
export class MbxPreferences extends Component {
|
|
10
|
+
static get observedAttributes() {
|
|
11
|
+
return ['storage-key'];
|
|
12
|
+
}
|
|
13
|
+
constructor() {
|
|
14
|
+
super();
|
|
15
|
+
this.store = preferences();
|
|
16
|
+
this.engine = null;
|
|
17
|
+
this.put = {};
|
|
18
|
+
this.pinned = null;
|
|
19
|
+
this.loading = true;
|
|
20
|
+
this.offEngine = null;
|
|
21
|
+
this.saved = new Set();
|
|
22
|
+
}
|
|
23
|
+
attributeChangedCallback() {
|
|
24
|
+
const key = this.getAttribute('storage-key');
|
|
25
|
+
const next = preferences(key === null ? {} : { key });
|
|
26
|
+
if (next === this.store)
|
|
27
|
+
return;
|
|
28
|
+
// The choices the viewer made before the key arrived, such as before a consent, go along.
|
|
29
|
+
for (const name of this.saved) {
|
|
30
|
+
next.set(name, this.store.get(name));
|
|
31
|
+
}
|
|
32
|
+
this.saved = new Set();
|
|
33
|
+
this.store = next;
|
|
34
|
+
}
|
|
35
|
+
/** Whether the element keeps `key`: every key, less the ones `except` names. */
|
|
36
|
+
keeps(key) {
|
|
37
|
+
return !(this.getAttribute('except') ?? '').split(/\s+/).includes(key);
|
|
38
|
+
}
|
|
39
|
+
/** The stored value of `key`, or undefined when the element leaves it alone. */
|
|
40
|
+
stored(key) {
|
|
41
|
+
return this.keeps(key) ? this.store.get(key) : undefined;
|
|
42
|
+
}
|
|
43
|
+
save(key, value) {
|
|
44
|
+
if (!this.keeps(key))
|
|
45
|
+
return;
|
|
46
|
+
this.store.set(key, value);
|
|
47
|
+
this.saved.add(key);
|
|
48
|
+
}
|
|
49
|
+
attach(player) {
|
|
50
|
+
const video = player.video;
|
|
51
|
+
const volume = this.stored('volume');
|
|
52
|
+
if (volume !== undefined)
|
|
53
|
+
video.volume = volume;
|
|
54
|
+
// A page that mutes for autoplay decides the mute itself, until the
|
|
55
|
+
// viewer unmutes. The player reflects the mute to `muted`, so the
|
|
56
|
+
// page's own is the one there at attach.
|
|
57
|
+
let pageMuted = player.hasAttribute('muted');
|
|
58
|
+
const muted = this.stored('muted');
|
|
59
|
+
if (muted !== undefined && !pageMuted)
|
|
60
|
+
video.muted = muted;
|
|
61
|
+
const look = this.stored('subtitle-look');
|
|
62
|
+
if (look?.size !== undefined)
|
|
63
|
+
player.setAttribute(SIZE, look.size);
|
|
64
|
+
if (look?.background !== undefined)
|
|
65
|
+
player.setAttribute(BACKGROUND, look.background);
|
|
66
|
+
this.on(video, 'volumechange', () => {
|
|
67
|
+
this.save('volume', video.volume);
|
|
68
|
+
pageMuted = pageMuted && video.muted;
|
|
69
|
+
if (!pageMuted)
|
|
70
|
+
this.save('muted', video.muted);
|
|
71
|
+
});
|
|
72
|
+
const watch = new MutationObserver(() => {
|
|
73
|
+
const size = player.getAttribute(SIZE);
|
|
74
|
+
const background = player.getAttribute(BACKGROUND);
|
|
75
|
+
this.save('subtitle-look', {
|
|
76
|
+
...(size === null ? {} : { size }),
|
|
77
|
+
...(background === null ? {} : { background }),
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
watch.observe(player, { attributes: true, attributeFilter: [SIZE, BACKGROUND] });
|
|
81
|
+
this.keep(() => {
|
|
82
|
+
watch.disconnect();
|
|
83
|
+
});
|
|
84
|
+
this.on(video, 'loadstart', () => {
|
|
85
|
+
this.loading = true;
|
|
86
|
+
this.put = {};
|
|
87
|
+
});
|
|
88
|
+
this.on(video, 'loadedmetadata', () => {
|
|
89
|
+
const rate = this.stored('rate');
|
|
90
|
+
if (rate !== undefined)
|
|
91
|
+
video.playbackRate = rate;
|
|
92
|
+
this.loading = false;
|
|
93
|
+
if (this.engine === null)
|
|
94
|
+
this.restoreNative(player);
|
|
95
|
+
});
|
|
96
|
+
this.on(video, 'ratechange', () => {
|
|
97
|
+
const moving = (this.engine ?? {});
|
|
98
|
+
const trick = moving.trick;
|
|
99
|
+
const live = moving.live?.edge != null || video.duration === Number.POSITIVE_INFINITY;
|
|
100
|
+
if (this.loading || live || (trick !== undefined && (trick.rate !== 1 || trick.scrubbing))) {
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
this.save('rate', video.playbackRate);
|
|
104
|
+
});
|
|
105
|
+
// A pin comes from the quality menu, which a click or a key reaches; the engine announces none.
|
|
106
|
+
this.on(player, 'click', () => {
|
|
107
|
+
setTimeout(() => {
|
|
108
|
+
this.notePin();
|
|
109
|
+
}, 0);
|
|
110
|
+
});
|
|
111
|
+
for (const name of ['audioTracks', 'textTracks']) {
|
|
112
|
+
const list = video[name];
|
|
113
|
+
if (list !== undefined)
|
|
114
|
+
this.on(list, 'change', () => this.noteNative(player));
|
|
115
|
+
}
|
|
116
|
+
this.on(player, 'sourcechange', () => {
|
|
117
|
+
this.follow(player.engine);
|
|
118
|
+
});
|
|
119
|
+
this.follow(player.engine);
|
|
120
|
+
this.keep(() => {
|
|
121
|
+
this.follow(null);
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
/** Puts the stored tracks and pin back on each engine once its manifest lists them, and saves the viewer's changes. */
|
|
125
|
+
follow(engine) {
|
|
126
|
+
this.offEngine?.();
|
|
127
|
+
this.offEngine = null;
|
|
128
|
+
this.engine = engine;
|
|
129
|
+
if (engine === null)
|
|
130
|
+
return;
|
|
131
|
+
let offChanged = () => undefined;
|
|
132
|
+
let offSelected = () => undefined;
|
|
133
|
+
const ready = () => {
|
|
134
|
+
offChanged();
|
|
135
|
+
this.restoreEngine(engine);
|
|
136
|
+
offSelected = engine.on('tracks:selected', () => {
|
|
137
|
+
this.noteEngine(engine);
|
|
138
|
+
});
|
|
139
|
+
};
|
|
140
|
+
if (engine.tracks.available.length > 0)
|
|
141
|
+
ready();
|
|
142
|
+
else
|
|
143
|
+
offChanged = engine.on('tracks:changed', ready);
|
|
144
|
+
this.offEngine = () => {
|
|
145
|
+
offChanged();
|
|
146
|
+
offSelected();
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
restoreEngine(engine) {
|
|
150
|
+
const tracks = engine.tracks;
|
|
151
|
+
for (const kind of ['audio', 'subtitles']) {
|
|
152
|
+
const type = kind === 'audio' ? 'audio' : 'text';
|
|
153
|
+
const list = tracks.available.filter((track) => track.contentType === type && tracks.selectable(track.id) && !track.forced);
|
|
154
|
+
const wanted = this.stored(kind);
|
|
155
|
+
// Inside the engine's own listener a selection queues, so what the
|
|
156
|
+
// element put back is what it asked for, not what `active` says yet.
|
|
157
|
+
this.put[kind] = this.engineActive(engine, kind);
|
|
158
|
+
if (wanted === null) {
|
|
159
|
+
if (!(tracks.active('text')?.forced ?? false))
|
|
160
|
+
tracks.deselect('text');
|
|
161
|
+
this.put[kind] = null;
|
|
162
|
+
}
|
|
163
|
+
else if (wanted !== undefined) {
|
|
164
|
+
const active = tracks.active(type);
|
|
165
|
+
const index = best(list.map(engineChoice), wanted, active === null ? -1 : list.indexOf(active));
|
|
166
|
+
const pick = list[index];
|
|
167
|
+
if (pick !== undefined) {
|
|
168
|
+
tracks.select(pick.id);
|
|
169
|
+
this.put[kind] = engineChoice(pick);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
const height = this.stored('quality');
|
|
174
|
+
const quality = engine.quality;
|
|
175
|
+
if (typeof height === 'number') {
|
|
176
|
+
// The tallest at or under the height the viewer pinned, else the shortest.
|
|
177
|
+
const fit = [...quality.selectable]
|
|
178
|
+
.filter((rendition) => rendition.height !== undefined)
|
|
179
|
+
.sort((a, b) => b.height - a.height);
|
|
180
|
+
const pick = fit.find((rendition) => rendition.height <= height) ?? fit[fit.length - 1];
|
|
181
|
+
if (pick !== undefined) {
|
|
182
|
+
quality.pin(pick.id);
|
|
183
|
+
this.pinned = pick.id;
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
this.pinned = quality.pinned;
|
|
188
|
+
}
|
|
189
|
+
/** The active track of `kind` as a choice: null for subtitles off, or for a forced track. */
|
|
190
|
+
engineActive(engine, kind) {
|
|
191
|
+
const track = engine.tracks.active(kind === 'audio' ? 'audio' : 'text');
|
|
192
|
+
return track === null || track.forced === true ? null : engineChoice(track);
|
|
193
|
+
}
|
|
194
|
+
noteEngine(engine) {
|
|
195
|
+
for (const kind of ['audio', 'subtitles']) {
|
|
196
|
+
const now = this.engineActive(engine, kind);
|
|
197
|
+
// A forced track replaces "off" on its own; the viewer's "off" came first.
|
|
198
|
+
if (kind === 'subtitles' && now === null && engine.tracks.active('text') !== null)
|
|
199
|
+
continue;
|
|
200
|
+
if (kind === 'audio' && now === null)
|
|
201
|
+
continue;
|
|
202
|
+
if (same(now, this.put[kind]))
|
|
203
|
+
continue;
|
|
204
|
+
this.put[kind] = now;
|
|
205
|
+
this.save(kind, now);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
notePin() {
|
|
209
|
+
const quality = this.engine?.quality;
|
|
210
|
+
if (quality === undefined || quality.pinned === this.pinned)
|
|
211
|
+
return;
|
|
212
|
+
this.pinned = quality.pinned;
|
|
213
|
+
const height = quality.renditions.find((rendition) => rendition.id === this.pinned)?.height;
|
|
214
|
+
this.save('quality', height ?? null);
|
|
215
|
+
}
|
|
216
|
+
/** The native session's audio and subtitle tracks, as Safari lists them. */
|
|
217
|
+
native(player, kind) {
|
|
218
|
+
const name = kind === 'audio' ? 'audioTracks' : 'textTracks';
|
|
219
|
+
const list = player.video[name];
|
|
220
|
+
const tracks = list === undefined ? [] : Array.from(list);
|
|
221
|
+
return kind === 'audio'
|
|
222
|
+
? tracks
|
|
223
|
+
: tracks.filter((track) => track.kind === 'subtitles' || track.kind === 'captions');
|
|
224
|
+
}
|
|
225
|
+
nativeActive(player, kind) {
|
|
226
|
+
const on = this.native(player, kind).find((track) => kind === 'audio' ? track.enabled === true : track.mode === 'showing');
|
|
227
|
+
return on === undefined ? null : nativeChoice(on);
|
|
228
|
+
}
|
|
229
|
+
restoreNative(player) {
|
|
230
|
+
for (const kind of ['audio', 'subtitles']) {
|
|
231
|
+
const tracks = this.native(player, kind);
|
|
232
|
+
const wanted = this.stored(kind);
|
|
233
|
+
if (wanted !== undefined && tracks.length > 0) {
|
|
234
|
+
const choices = tracks.map(nativeChoice);
|
|
235
|
+
const index = wanted === null ? -1 : best(choices, wanted);
|
|
236
|
+
// One audio track plays; a subtitle track shows, or none for off.
|
|
237
|
+
if (index !== -1 || (kind === 'subtitles' && wanted === null)) {
|
|
238
|
+
tracks.forEach((track, at) => {
|
|
239
|
+
if (kind === 'audio')
|
|
240
|
+
track.enabled = at === index;
|
|
241
|
+
else
|
|
242
|
+
track.mode = at === index ? 'showing' : 'disabled';
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
this.put[kind] = this.nativeActive(player, kind);
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
noteNative(player) {
|
|
250
|
+
if (this.engine !== null || this.loading)
|
|
251
|
+
return;
|
|
252
|
+
for (const kind of ['audio', 'subtitles']) {
|
|
253
|
+
const now = this.nativeActive(player, kind);
|
|
254
|
+
if ((kind === 'audio' && now === null) || same(now, this.put[kind]))
|
|
255
|
+
continue;
|
|
256
|
+
this.put[kind] = now;
|
|
257
|
+
this.save(kind, now);
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
//# sourceMappingURL=element.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"element.js","sourceRoot":"","sources":["../src/element.ts"],"names":[],"mappings":"AAaA,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EAAE,EAAE,EAAE;wBAC3B,IAAI,IAAI,KAAK,OAAO;4BAAE,KAAK,CAAC,OAAO,GAAG,EAAE,KAAK,KAAK,CAAC;;4BAC9C,KAAK,CAAC,IAAI,GAAG,EAAE,KAAK,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,UAAU,CAAC;oBAC1D,CAAC,CAAC,CAAC;gBACL,CAAC;YACH,CAAC;YACD,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QACnD,CAAC;IACH,CAAC;IAEO,UAAU,CAAC,MAAkB;QACnC,IAAI,IAAI,CAAC,MAAM,KAAK,IAAI,IAAI,IAAI,CAAC,OAAO;YAAE,OAAO;QACjD,KAAK,MAAM,IAAI,IAAI,CAAC,OAAO,EAAE,WAAW,CAAU,EAAE,CAAC;YACnD,MAAM,GAAG,GAAG,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;YAC5C,IAAI,CAAC,IAAI,KAAK,OAAO,IAAI,GAAG,KAAK,IAAI,CAAC,IAAI,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;gBAAE,SAAS;YAC9E,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC;YACrB,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,GAAkB,CAAC,CAAC;QACtC,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import toPropertyKey from "./toPropertyKey.js";
|
|
2
|
+
// \0@oxc-project+runtime@0.155.0/helpers/esm/defineProperty.js
|
|
3
|
+
function _defineProperty(e, r, t) {
|
|
4
|
+
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
5
|
+
value: t,
|
|
6
|
+
enumerable: !0,
|
|
7
|
+
configurable: !0,
|
|
8
|
+
writable: !0
|
|
9
|
+
}) : e[r] = t, e;
|
|
10
|
+
}
|
|
11
|
+
export { _defineProperty as default };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import _defineProperty from "./defineProperty.js";
|
|
2
|
+
// \0@oxc-project+runtime@0.155.0/helpers/esm/objectSpread2.js
|
|
3
|
+
function ownKeys(e, r) {
|
|
4
|
+
var t = Object.keys(e);
|
|
5
|
+
if (Object.getOwnPropertySymbols) {
|
|
6
|
+
var o = Object.getOwnPropertySymbols(e);
|
|
7
|
+
r && (o = o.filter(function(r) {
|
|
8
|
+
return Object.getOwnPropertyDescriptor(e, r).enumerable;
|
|
9
|
+
})), t.push.apply(t, o);
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
}
|
|
13
|
+
function _objectSpread2(e) {
|
|
14
|
+
for (var r = 1; r < arguments.length; r++) {
|
|
15
|
+
var t = null != arguments[r] ? arguments[r] : {};
|
|
16
|
+
r % 2 ? ownKeys(Object(t), !0).forEach(function(r) {
|
|
17
|
+
_defineProperty(e, r, t[r]);
|
|
18
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r) {
|
|
19
|
+
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
return e;
|
|
23
|
+
}
|
|
24
|
+
export { _objectSpread2 as default };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import _typeof from "./typeof.js";
|
|
2
|
+
// \0@oxc-project+runtime@0.155.0/helpers/esm/toPrimitive.js
|
|
3
|
+
function toPrimitive(t, r) {
|
|
4
|
+
if ("object" != _typeof(t) || !t) return t;
|
|
5
|
+
var e = t[Symbol.toPrimitive];
|
|
6
|
+
if (void 0 !== e) {
|
|
7
|
+
var i = e.call(t, r || "default");
|
|
8
|
+
if ("object" != _typeof(i)) return i;
|
|
9
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
10
|
+
}
|
|
11
|
+
return ("string" === r ? String : Number)(t);
|
|
12
|
+
}
|
|
13
|
+
export { toPrimitive as default };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import _typeof from "./typeof.js";
|
|
2
|
+
import toPrimitive from "./toPrimitive.js";
|
|
3
|
+
// \0@oxc-project+runtime@0.155.0/helpers/esm/toPropertyKey.js
|
|
4
|
+
function toPropertyKey(t) {
|
|
5
|
+
var i = toPrimitive(t, "string");
|
|
6
|
+
return "symbol" == _typeof(i) ? i : i + "";
|
|
7
|
+
}
|
|
8
|
+
export { toPropertyKey as default };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// \0@oxc-project+runtime@0.155.0/helpers/esm/typeof.js
|
|
2
|
+
function _typeof(o) {
|
|
3
|
+
"@babel/helpers - typeof";
|
|
4
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
5
|
+
return typeof o;
|
|
6
|
+
} : function(o) {
|
|
7
|
+
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
8
|
+
}, _typeof(o);
|
|
9
|
+
}
|
|
10
|
+
export { _typeof as default };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { PLAYER, findPlayer } from "./host.js";
|
|
2
|
+
// src/component.ts
|
|
3
|
+
var Component = class extends HTMLElement {
|
|
4
|
+
constructor() {
|
|
5
|
+
super();
|
|
6
|
+
this.player = null;
|
|
7
|
+
this.offs = [];
|
|
8
|
+
this.epoch = 0;
|
|
9
|
+
}
|
|
10
|
+
connectedCallback() {
|
|
11
|
+
const found = findPlayer(this);
|
|
12
|
+
if (found === null) return;
|
|
13
|
+
this.epoch += 1;
|
|
14
|
+
const epoch = this.epoch;
|
|
15
|
+
const attach = () => {
|
|
16
|
+
if (epoch !== this.epoch || !this.isConnected) return;
|
|
17
|
+
customElements.upgrade(found);
|
|
18
|
+
if (!("video" in found)) return;
|
|
19
|
+
this.player = found;
|
|
20
|
+
this.attach(this.player);
|
|
21
|
+
};
|
|
22
|
+
if ("video" in found) attach();
|
|
23
|
+
else customElements.whenDefined(PLAYER).then(attach);
|
|
24
|
+
}
|
|
25
|
+
disconnectedCallback() {
|
|
26
|
+
this.epoch += 1;
|
|
27
|
+
for (const off of this.offs) off();
|
|
28
|
+
this.offs = [];
|
|
29
|
+
this.player = null;
|
|
30
|
+
}
|
|
31
|
+
/** Adds `fn` for `name` on `target`, removed on detach. */
|
|
32
|
+
on(target, name, fn, options) {
|
|
33
|
+
target.addEventListener(name, fn, options);
|
|
34
|
+
this.offs.push(() => {
|
|
35
|
+
target.removeEventListener(name, fn, options);
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
/** Runs `off` on detach. */
|
|
39
|
+
keep(off) {
|
|
40
|
+
this.offs.push(off);
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
export { Component };
|