@mintplayer/vue-video-player 0.0.0-stage → 3.0.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/BehaviorSubject-B43NQ6Ep.js +1 -0
- package/BehaviorSubject-CMEAHufI.mjs +27 -0
- package/README.md +40 -2
- package/api-1vv4CoYw.mjs +201 -0
- package/api-B6qyhEI3.js +1 -0
- package/api-BXwOuGGp.js +9 -0
- package/api-Be3WmSZ1.mjs +140 -0
- package/api-Bqn8VxG0.mjs +103 -0
- package/api-BvYiv0Ae.mjs +79 -0
- package/api-C-ycGc3Y.js +1 -0
- package/api-C2IVrne3.mjs +72 -0
- package/api-C2TK5P8W.js +1 -0
- package/api-C355Aio5.js +1 -0
- package/api-CERg1lOE.js +9 -0
- package/api-CExMX1Pt.js +1 -0
- package/api-CcP3AdSm.mjs +2590 -0
- package/api-CjAlKHz7.js +38 -0
- package/api-CqCOtAUb.mjs +84 -0
- package/api-CqCgSUqk.mjs +87 -0
- package/api-D0zr0PoA.js +1 -0
- package/api-D55GaoJG.js +1 -0
- package/api-D5spnI9J.js +1 -0
- package/api-DcMW2iN2.mjs +90 -0
- package/api-MxZ7gaDR.mjs +118 -0
- package/api-O56wbN98.mjs +91 -0
- package/api-noLuragZ.js +1 -0
- package/api-yj6szShM.mjs +93 -0
- package/debounceTime-B4ed_w3_.js +1 -0
- package/debounceTime-T7webJ8G.mjs +197 -0
- package/executeSchedule-0S0ESNjs.js +1 -0
- package/executeSchedule-CVYaVzo8.mjs +9 -0
- package/filter-Ck2Y29AT.js +1 -0
- package/filter-LJ9oGNCV.mjs +11 -0
- package/fromEvent-CAH0A2rD.js +1 -0
- package/fromEvent-koPx2dM9.mjs +45 -0
- package/index.css +2 -0
- package/index.d.ts +2 -0
- package/index.js +1 -0
- package/index.mjs +216 -0
- package/isScheduler-dRIR0jo6.mjs +106 -0
- package/isScheduler-gBWm9tsU.js +1 -0
- package/lib/types.d.ts +12 -0
- package/lib/vue-video-player.vue.d.ts +18 -0
- package/mapOneOrManyArgs-Djtipmha.mjs +22 -0
- package/mapOneOrManyArgs-gqACUB3e.js +1 -0
- package/package.json +23 -4
- package/pairwise-BZ7jlLp1.mjs +12 -0
- package/pairwise-ksRX5aBP.js +1 -0
- package/src-BWj0KcGd.mjs +1043 -0
- package/src-C2Bgj48W.mjs +51 -0
- package/src-CYCud0_r.js +1 -0
- package/src-CluKb0O6.js +3 -0
- package/take-BVSpP1qC.js +1 -0
- package/take-DvAG1RRS.mjs +64 -0
- package/takeUntil-MRP2QN5v.js +1 -0
- package/takeUntil-zxKl50Ag.mjs +172 -0
- package/timer-BOeyNkh5.mjs +20 -0
- package/timer-mrjvJwyN.js +1 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("./src-CluKb0O6.js");e.w();var t=function(t){e.y(n,t);function n(e){var n=t.call(this)||this;return n._value=e,n}return Object.defineProperty(n.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),n.prototype._subscribe=function(e){var n=t.prototype._subscribe.call(this,e);return!n.closed&&e.next(this._value),n},n.prototype.getValue=function(){var e=this,t=e.hasError,n=e.thrownError,r=e._value;if(t)throw n;return this._throwIfClosed(),r},n.prototype.next=function(e){t.prototype.next.call(this,this._value=e)},n}(e.i);Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return t}});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { i as e, w as t, y as n } from "./src-BWj0KcGd.mjs";
|
|
2
|
+
// ../../../node_modules/rxjs/dist/esm5/internal/BehaviorSubject.js
|
|
3
|
+
t();
|
|
4
|
+
var r = function(e) {
|
|
5
|
+
n(t, e);
|
|
6
|
+
function t(t) {
|
|
7
|
+
var n = e.call(this) || this;
|
|
8
|
+
return n._value = t, n;
|
|
9
|
+
}
|
|
10
|
+
return Object.defineProperty(t.prototype, "value", {
|
|
11
|
+
get: function() {
|
|
12
|
+
return this.getValue();
|
|
13
|
+
},
|
|
14
|
+
enumerable: !1,
|
|
15
|
+
configurable: !0
|
|
16
|
+
}), t.prototype._subscribe = function(t) {
|
|
17
|
+
var n = e.prototype._subscribe.call(this, t);
|
|
18
|
+
return !n.closed && t.next(this._value), n;
|
|
19
|
+
}, t.prototype.getValue = function() {
|
|
20
|
+
var e = this, t = e.hasError, n = e.thrownError, r = e._value;
|
|
21
|
+
if (t) throw n;
|
|
22
|
+
return this._throwIfClosed(), r;
|
|
23
|
+
}, t.prototype.next = function(t) {
|
|
24
|
+
e.prototype.next.call(this, this._value = t);
|
|
25
|
+
}, t;
|
|
26
|
+
}(e);
|
|
27
|
+
export { r as t };
|
package/README.md
CHANGED
|
@@ -1,3 +1,41 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @mintplayer/vue-video-player
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A Vue 3 wrapper for the framework agnostic `@mintplayer/video-player`. It wires up
|
|
4
|
+
all supported provider plugins and exposes a declarative component that mirrors the
|
|
5
|
+
APIs used by the Angular and React packages.
|
|
6
|
+
|
|
7
|
+
Formerly published as `@mintplayer/v-video-player` (18.x). To migrate, install this package and
|
|
8
|
+
replace `VVideoPlayer` with `VueVideoPlayer` (and `VVideoPlayerProps`/`VVideoPlayerEmits` likewise).
|
|
9
|
+
Its major version follows Vue's.
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```vue
|
|
14
|
+
<script setup lang="ts">
|
|
15
|
+
import { ref } from 'vue';
|
|
16
|
+
import { VueVideoPlayer } from '@mintplayer/vue-video-player';
|
|
17
|
+
import { EPlayerState } from '@mintplayer/player-provider';
|
|
18
|
+
|
|
19
|
+
const url = ref('https://www.youtube.com/watch?v=tt2k8PGm-TI');
|
|
20
|
+
const volume = ref(50);
|
|
21
|
+
const mute = ref(false);
|
|
22
|
+
const playerState = ref(EPlayerState.unstarted);
|
|
23
|
+
</script>
|
|
24
|
+
|
|
25
|
+
<template>
|
|
26
|
+
<VueVideoPlayer
|
|
27
|
+
:url="url"
|
|
28
|
+
v-model:volume="volume"
|
|
29
|
+
v-model:mute="mute"
|
|
30
|
+
v-model:playerState="playerState"
|
|
31
|
+
/>
|
|
32
|
+
</template>
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Building
|
|
36
|
+
|
|
37
|
+
Run `nx build vue-video-player` to bundle the library with Vite.
|
|
38
|
+
|
|
39
|
+
## Running unit tests
|
|
40
|
+
|
|
41
|
+
Run `nx test vue-video-player` to execute the unit tests via [Vitest](https://vitest.dev/).
|
package/api-1vv4CoYw.mjs
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
import { i as e, n as t, r as n, t as r } from "./src-BWj0KcGd.mjs";
|
|
2
|
+
import { t as i } from "./BehaviorSubject-CMEAHufI.mjs";
|
|
3
|
+
import { t as a } from "./takeUntil-zxKl50Ag.mjs";
|
|
4
|
+
import { t as o } from "./timer-BOeyNkh5.mjs";
|
|
5
|
+
// ../../platforms/mixcloud-player/api/remote/consts.ts
|
|
6
|
+
var s = typeof window < "u" && typeof window.scrollY == "number", c = class extends Promise {
|
|
7
|
+
constructor() {
|
|
8
|
+
let e = {};
|
|
9
|
+
super((t) => {
|
|
10
|
+
e.resolve = t;
|
|
11
|
+
}), this.resolveFn = e.resolve;
|
|
12
|
+
}
|
|
13
|
+
static get [Symbol.species]() {
|
|
14
|
+
return Promise;
|
|
15
|
+
}
|
|
16
|
+
resolve(e) {
|
|
17
|
+
this.resolveFn(e);
|
|
18
|
+
}
|
|
19
|
+
reject() {
|
|
20
|
+
throw Error("NotImplemented Reject");
|
|
21
|
+
}
|
|
22
|
+
get promise() {
|
|
23
|
+
throw Error("Old deferred promise property access");
|
|
24
|
+
}
|
|
25
|
+
}, l = "https://www.mixcloud.com", u = s && window.testingPlayerApi, d = class {
|
|
26
|
+
constructor(e) {
|
|
27
|
+
this.methodCounter = 0, this.methodResponses = {}, this.eventHandlers = {}, this.windowOnReceiveMessageCallbacks = [], this.external = {
|
|
28
|
+
ready: new c(),
|
|
29
|
+
events: {},
|
|
30
|
+
apiBuilt: !1,
|
|
31
|
+
destroy: () => this.destroy()
|
|
32
|
+
}, this.receiveMessage = (e, t) => {
|
|
33
|
+
switch (e) {
|
|
34
|
+
case "ready":
|
|
35
|
+
this.send({ type: "getApi" });
|
|
36
|
+
break;
|
|
37
|
+
case "api":
|
|
38
|
+
this.buildApi(t);
|
|
39
|
+
break;
|
|
40
|
+
case "event": {
|
|
41
|
+
let e = this.eventHandlers[t.eventName];
|
|
42
|
+
e && e.apply(this.external, t.args);
|
|
43
|
+
break;
|
|
44
|
+
}
|
|
45
|
+
case "methodResponse": this.methodResponses[t.methodId] && (this.methodResponses[t.methodId].resolve(t.value), delete this.methodResponses[t.methodId]);
|
|
46
|
+
}
|
|
47
|
+
}, this.deferredMethodResponse = (e, t, ...n) => {
|
|
48
|
+
let r, i = new Promise((e) => {
|
|
49
|
+
r = e, this.send({
|
|
50
|
+
type: "method",
|
|
51
|
+
data: {
|
|
52
|
+
methodId: this.methodCounter,
|
|
53
|
+
methodName: t,
|
|
54
|
+
args: n
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
return i.resolve = r, i;
|
|
59
|
+
}, this.buildMethod = (e) => (...t) => {
|
|
60
|
+
this.methodCounter++;
|
|
61
|
+
let n = this.methodCounter;
|
|
62
|
+
return this.methodResponses[this.methodCounter] = this.deferredMethodResponse(n, e, ...t), this.methodResponses[this.methodCounter];
|
|
63
|
+
}, this.buildApi = ({ methods: e, events: t }) => {
|
|
64
|
+
this.external.apiBuilt || (e.forEach((e) => {
|
|
65
|
+
this.external[e] = this.buildMethod(e);
|
|
66
|
+
}), t.forEach((e) => {
|
|
67
|
+
this.eventHandlers[e] = f(), this.external.events[e] = this.eventHandlers[e].external;
|
|
68
|
+
}), this.external.apiBuilt = !0, this.external.ready.resolve(this.external));
|
|
69
|
+
}, this.onReceiveMessage = (e) => {
|
|
70
|
+
if (!u && ![
|
|
71
|
+
l,
|
|
72
|
+
"https://player-widget.mixcloud.com",
|
|
73
|
+
window.location.origin
|
|
74
|
+
].includes(e.origin)) {
|
|
75
|
+
console.error("Playerwidget received message from incorrect origin", {
|
|
76
|
+
expected: l,
|
|
77
|
+
got: e.origin
|
|
78
|
+
});
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
let t;
|
|
82
|
+
try {
|
|
83
|
+
t = JSON.parse(e.data);
|
|
84
|
+
} catch (e) {
|
|
85
|
+
console.error("Playerwidget received malformed JSON data", e);
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
t.mixcloud === "playerWidget" ? this.windowOnReceiveMessageCallbacks.forEach(({ callback: n, window: r }) => {
|
|
89
|
+
r === e.source && n(t.type, t.data);
|
|
90
|
+
}) : console.error("Playerwidget received incorrect data");
|
|
91
|
+
}, this.send = (e) => {
|
|
92
|
+
this.otherWindow.postMessage(JSON.stringify(e), "*");
|
|
93
|
+
}, this.otherWindow = e.contentWindow, this.windowOnReceiveMessageCallbacks.push({
|
|
94
|
+
window: this.otherWindow,
|
|
95
|
+
callback: this.receiveMessage
|
|
96
|
+
}), this.send({ type: "getApi" }), window.addEventListener && window.addEventListener("message", this.onReceiveMessage, !1);
|
|
97
|
+
}
|
|
98
|
+
destroy() {
|
|
99
|
+
window.removeEventListener && window.removeEventListener("message", this.onReceiveMessage, !1);
|
|
100
|
+
}
|
|
101
|
+
}, f = () => {
|
|
102
|
+
let e = [];
|
|
103
|
+
return {
|
|
104
|
+
apply: (t, n) => {
|
|
105
|
+
e.forEach((e) => {
|
|
106
|
+
e.apply(t, n);
|
|
107
|
+
});
|
|
108
|
+
},
|
|
109
|
+
external: {
|
|
110
|
+
on: (t) => {
|
|
111
|
+
e.push(t);
|
|
112
|
+
},
|
|
113
|
+
off: (t) => {
|
|
114
|
+
e = e.filter((e) => e !== t);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
}, p = (e) => new d(e).external, m = class {
|
|
119
|
+
constructor() {
|
|
120
|
+
this.urlRegexes = [/* @__PURE__ */ new RegExp(/http[s]{0,1}:\/\/(www\.){0,1}mixcloud\.com(?<id>\/[0-9A-Za-z-]+\/[0-9A-Za-z-]+)\/{0,1}/)], this.apiReady$ = new i(!1);
|
|
121
|
+
}
|
|
122
|
+
get id() {
|
|
123
|
+
return "mixcloud";
|
|
124
|
+
}
|
|
125
|
+
match2id(e) {
|
|
126
|
+
if (!e.groups) throw "match2id - match.groups is undefined";
|
|
127
|
+
return `${e.groups.id}/`;
|
|
128
|
+
}
|
|
129
|
+
loadApi() {
|
|
130
|
+
return new Promise((e) => e(!0)).then((e) => this.apiReady$.next(!0));
|
|
131
|
+
}
|
|
132
|
+
prepareHtml(e) {
|
|
133
|
+
if (!e.initialVideoId) throw "The MixCloud api requires an initial video id";
|
|
134
|
+
return `<iframe id="${e.domId}" style="max-width:100%" src="https://www.mixcloud.com/widget/iframe/?autoplay=${+!!e.autoplay}&feed=${encodeURIComponent(e.initialVideoId)}" allow="autoplay"></iframe>`;
|
|
135
|
+
}
|
|
136
|
+
createPlayer(i, s) {
|
|
137
|
+
return new Promise((c, l) => {
|
|
138
|
+
if (!i.element) return l("The MixCloud api requires the options.element to be set");
|
|
139
|
+
let u = i.element.querySelector("iframe");
|
|
140
|
+
if (!u) return l("There doesn't seem to be an iframe");
|
|
141
|
+
let d = new e(), f, m = p(u);
|
|
142
|
+
m.ready.then(() => {
|
|
143
|
+
let e;
|
|
144
|
+
f = n({
|
|
145
|
+
capabilities: [r.volume, r.getTitle],
|
|
146
|
+
loadVideoById: (e) => {
|
|
147
|
+
m.load && m.load(e, i.autoplay);
|
|
148
|
+
},
|
|
149
|
+
setPlayerState: (e) => {
|
|
150
|
+
switch (e) {
|
|
151
|
+
case t.playing:
|
|
152
|
+
m.play && m.play();
|
|
153
|
+
break;
|
|
154
|
+
case t.paused:
|
|
155
|
+
m.pause && m.pause();
|
|
156
|
+
break;
|
|
157
|
+
case t.ended:
|
|
158
|
+
case t.unstarted:
|
|
159
|
+
}
|
|
160
|
+
},
|
|
161
|
+
setMute: (e) => {
|
|
162
|
+
throw "MixCloud doesn't allow mute";
|
|
163
|
+
},
|
|
164
|
+
setVolume: (e) => m.setVolume && m.setVolume(e / 100),
|
|
165
|
+
setProgress: (e) => m.seek && m.seek(e),
|
|
166
|
+
setSize: (e, t) => {
|
|
167
|
+
u.width = String(e), u.height = String(t);
|
|
168
|
+
},
|
|
169
|
+
getTitle: () => new Promise((e, t) => {
|
|
170
|
+
m.getCurrentKey ? m.getCurrentKey().then((t) => e(t)) : t("Player not yet initialized");
|
|
171
|
+
}),
|
|
172
|
+
setFullscreen: (e) => {
|
|
173
|
+
throw "MixCloud doesn't support fullscreen";
|
|
174
|
+
},
|
|
175
|
+
getFullscreen: () => new Promise((e) => e(!1)),
|
|
176
|
+
setPip: (e) => {
|
|
177
|
+
throw "MixCloud doesn't support picture-in-picture";
|
|
178
|
+
},
|
|
179
|
+
getPip: () => new Promise((e) => e(!1)),
|
|
180
|
+
destroy: () => {
|
|
181
|
+
m.events.play.off(e.playHandler), m.events.pause.off(e.pauseHandler), m.events.ended.off(e.endedHandler), m.events.progress.off(e.progressHandler), m.destroy(), setTimeout(() => d.next(!0), 50);
|
|
182
|
+
}
|
|
183
|
+
}), e = this.hookEvents(m, f), typeof window < "u" && o(0, 50).pipe(a(d), a(s)).subscribe(() => {
|
|
184
|
+
m.getVolume && m.getVolume().then((e) => f.onVolumeChange(e * 100));
|
|
185
|
+
}), c(f);
|
|
186
|
+
});
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
hookEvents(e, n) {
|
|
190
|
+
let r = () => n.onStateChange(t.playing), i = () => n.onStateChange(t.paused), a = () => n.onStateChange(t.ended), o = (e, t) => {
|
|
191
|
+
n.onCurrentTimeChange(e), n.onDurationChange(t);
|
|
192
|
+
};
|
|
193
|
+
return e.events.play.on(r), e.events.pause.on(i), e.events.ended.on(a), e.events.progress.on(o), {
|
|
194
|
+
playHandler: r,
|
|
195
|
+
pauseHandler: i,
|
|
196
|
+
endedHandler: a,
|
|
197
|
+
progressHandler: o
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
};
|
|
201
|
+
export { m as MixcloudApiService };
|
package/api-B6qyhEI3.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("./src-CluKb0O6.js"),t=require("./takeUntil-MRP2QN5v.js"),n=require("./timer-mrjvJwyN.js");var r=require("./src-CYCud0_r.js").t(),i=class{get id(){return`soundcloud`}urlRegexes=[new RegExp(/(?<id>http[s]{0,1}:\/\/(www\.){0,1}soundcloud\.com\/.+)$/,`g`)];loadApi(){return(0,r.loadScript)(`https://w.soundcloud.com/player/api.js`)}prepareHtml(e){let t=encodeURIComponent(e.initialVideoId??``);return`<iframe id="${e.domId}" width="${e.width}" height="${e.height}" style="max-width:100%" src="https://w.soundcloud.com/player/?url=${t}&show_teaser=false&" allow="autoplay"></iframe>`}createPlayer(r,i){return new Promise((a,o)=>{if(!r.element)return o(`The SoundCloud api requires the options.element to be set`);let s=new e.i,c=SC.Widget(r.element.getElementsByTagName(`iframe`)[0]),l=50,u=50,d=e.r({capabilities:[e.t.volume,e.t.getTitle],loadVideoById:e=>c.load(e,{auto_play:r.autoplay}),setPlayerState:t=>{switch(t){case e.n.playing:c.play();break;case e.n.paused:c.pause();break;case e.n.ended:case e.n.unstarted:}},setMute:e=>{e?(u=l,c.setVolume(0)):c.setVolume(u)},setVolume:e=>{l=e,c.setVolume(e)},setProgress:e=>c.seekTo(e*1e3),setSize:(e,t)=>{if(r.element){let n=r.element.querySelector(`iframe`);n&&(n.width=String(e),n.height=String(t))}},getTitle:()=>new Promise(e=>c.getCurrentSound(t=>e(t.description??t.title))),setFullscreen:e=>{e&&(console.warn(`SoundCloud player doesn't support fullscreen mode`),setTimeout(()=>d.onFullscreenChange(!1),50))},getFullscreen:()=>new Promise(e=>e(!1)),setPip:e=>{e&&(console.warn(`SoundCloud player doesn't support PIP mode`),setTimeout(()=>d.onPipChange(!1),50))},getPip:()=>new Promise(e=>e(!1)),destroy:()=>s.next(!0)});c.bind(SC.Widget.Events.READY,()=>{a(d),typeof window<`u`&&n.t(0,50).pipe(t.t(s),t.t(i)).subscribe(()=>{c.getVolume(e=>{e>0&&(l=e),d.onVolumeChange(e),d.onMuteChange(e===0)})})}),c.bind(SC.Widget.Events.PLAY,()=>{d.onStateChange(e.n.playing),c.getDuration(e=>d.onDurationChange(e/1e3))}),c.bind(SC.Widget.Events.PAUSE,()=>d.onStateChange(e.n.paused)),c.bind(SC.Widget.Events.FINISH,()=>d.onStateChange(e.n.ended)),c.bind(SC.Widget.Events.PLAY_PROGRESS,e=>d.onCurrentTimeChange(e.currentPosition/1e3))})}};exports.SoundcloudApiService=i;
|
package/api-BXwOuGGp.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
const e=require("./src-CluKb0O6.js"),t=require("./take-BVSpP1qC.js"),n=require("./takeUntil-MRP2QN5v.js"),r=require("./timer-mrjvJwyN.js"),i=require("./fromEvent-CAH0A2rD.js"),a=require("./filter-Ck2Y29AT.js");var o=class{constructor(){this.urlRegexes=[new RegExp(/(?<id>https?:\/\/.+\.(?<audiotype>mp4a|mpga|mp2a|weba|m4a|m4b|m2a|m3a|mp2|mp3|wav|aac|oga|spx))(?![a-z0-9])/,`g`),new RegExp(/(?<id>https?:\/\/.+\.(?<videotype>webm|mp4|ogg|ogv|mov|m4v))(?![a-z0-9])/,`g`)]}get id(){return`file`}get canReusePlayer(){return!1}loadApi(){return Promise.resolve()}match2id(e){if(!e.groups)throw`match2id - match.groups is undefined`;let t=e.groups.audiotype?`audio`:e.groups.videotype?`video`:``;if(t===``)throw`Cannot match type`;return JSON.stringify({tagType:t,id:e.groups.id,extension:e.groups.audiotype??e.groups.videotype})}prepareHtml(e){if(!e.initialVideoId)throw`The File api requires an initial video id`;let t=JSON.parse(e.initialVideoId),n=t.id.replace(/["<>]/g,``);switch(t.tagType){case`audio`:return`
|
|
2
|
+
<div style="width:${e.width}px;height:${e.height}px;max-width:100%;overflow:hidden;position:relative;margin:0 auto">
|
|
3
|
+
<div style="height:100%;display:flex;width:100%;flex-direction:column;align-items:center;justify-content:space-around;position:absolute">
|
|
4
|
+
<audio src="${n}" ${e.autoplay?`autoplay`:``} controls="on" style="z-index:5;max-width:100%"></audio>
|
|
5
|
+
</div>
|
|
6
|
+
<div style="height:100%;display:flex;width:100%;flex-direction:column;align-items:center;justify-content:space-around;position:absolute">
|
|
7
|
+
<canvas width="${e.width}" height="${e.height}"></canvas>
|
|
8
|
+
</div>
|
|
9
|
+
</div>`;case`video`:return`<video src="${n}" style="max-width:100%" ${e.autoplay?`autoplay`:``} width="${e.width??500}" height="${e.height??300}" controls></video>`;default:throw`Unsupported media type: ${t.extension}`}}createPlayer(a,o){return new Promise((s,c)=>{if(!a.element)return c(`The FilePlayer requires the options.element to be set`);let l=a.element.querySelector(`audio, video`);if(!l)return c(`There doesn't seem to be an audio or video element`);let u=a.element.querySelector(`div`),d=new e.i,f;i.t(l,`canplay`).pipe(t.t(1),n.t(d),n.t(o)).subscribe(()=>{if(f=e.r({capabilities:[e.t.volume,e.t.mute,e.t.fullscreen,e.t.pictureInPicture],loadVideoById:e=>{},setPlayerState:t=>{switch(t){case e.n.playing:l.play();break;case e.n.paused:l.pause()}},setMute:e=>l.muted=e,setVolume:e=>l.volume=e/100,setProgress:e=>l.fastSeek(e),setSize:(e,t)=>{l instanceof HTMLVideoElement&&(l.width=e,l.height=t)},getTitle:()=>new Promise((e,t)=>{t(`File player doesn't support getting the title`)}),setFullscreen:e=>{e?u.requestFullscreen():document.fullscreenElement===u&&document.exitFullscreen()},getFullscreen:()=>new Promise(e=>e(!1)),setPip:e=>{l instanceof HTMLVideoElement&&(e?l.requestPictureInPicture():document.pictureInPictureElement===l&&document.exitPictureInPicture())},getPip:()=>new Promise(e=>e(!1)),destroy:()=>{l.pause(),l.removeAttribute(`src`),l.load(),document.pictureInPictureElement===l&&document.exitPictureInPicture(),d.next(!0)}}),l instanceof HTMLAudioElement){let e=a.element.getElementsByTagName(`canvas`);e.length>0&&this.createEqualizer(l,e[0],o),i.t(u,`fullscreenchange`).pipe(n.t(d),n.t(o)).subscribe(()=>f.onFullscreenChange(document.fullscreenElement===u))}else i.t(l,`fullscreenchange`).pipe(n.t(d),n.t(o)).subscribe(()=>f.onFullscreenChange(document.fullscreenElement===l));i.t(l,`volumechange`).pipe(n.t(d),n.t(o)).subscribe(()=>{f.onVolumeChange(l.volume*100),f.onMuteChange(l.muted)}),i.t(l,`enterpictureinpicture`).pipe(n.t(d),n.t(o)).subscribe(()=>f.onPipChange(!0)),i.t(l,`leavepictureinpicture`).pipe(n.t(d),n.t(o)).subscribe(()=>f.onPipChange(!1)),i.t(l,`play`).pipe(n.t(d),n.t(o)).subscribe(()=>f.onStateChange(e.n.playing)),i.t(l,`pause`).pipe(n.t(d),n.t(o)).subscribe(()=>f.onStateChange(e.n.paused)),i.t(l,`ended`).pipe(n.t(d),n.t(o)).subscribe(()=>f.onStateChange(e.n.ended)),typeof window<`u`&&r.t(0,50).pipe(n.t(d),n.t(o)).subscribe(()=>{f.onCurrentTimeChange(l.currentTime),f.onDurationChange(l.duration)}),setTimeout(()=>{f.onVolumeChange(l.volume*100),f.onMuteChange(l.muted)},20),s(f)})})}createEqualizer(e,t,n){let r=new AudioContext,i=r.createAnalyser(),o=e=>{let t=Math.log(e/4)/Math.log(2);i.fftSize=2**Math.round(t)},s=new ResizeObserver(e=>{let t=e[0].contentRect.width;o(t)});s.observe(t),o(t.width);let c=r.createMediaElementSource(e);c.connect(i),i.connect(r.destination),this.frameLooper(i,t,n);let l=n.pipe(a.t(e=>e)).subscribe(()=>{i.disconnect(),c.disconnect(),r.close(),s.unobserve(t),l.unsubscribe()})}frameLooper(e,t,n){let r=t.getContext(`2d`);if(!r)throw`Could not get drawing context`;let i=!1,o=n.pipe(a.t(e=>e)).subscribe(()=>{i=!0,o.unsubscribe()});if(typeof window<`u`){let n=window,a=i=>{n.RequestAnimationFrame=window.requestAnimationFrame(a)||n.msRequestAnimationFrame(a)||n.mozRequestAnimationFrame(a)||n.webkitRequestAnimationFrame(a);let o=new Uint8Array(e.frequencyBinCount);t.clientWidth/4,e.getByteFrequencyData(o),r.clearRect(0,0,t.width,t.height),r.fillStyle=`#888888`;for(let e=0;e<o.length;e++){let n=e*t.clientWidth/o.length,i=-(o[e]/2);r.fillRect(n,t.height,2,i)}};i||a(0)}}};exports.FileApiService=o;
|
package/api-Be3WmSZ1.mjs
ADDED
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { i as e, n as t, r as n, t as r } from "./src-BWj0KcGd.mjs";
|
|
2
|
+
import { t as i } from "./take-DvAG1RRS.mjs";
|
|
3
|
+
import { t as a } from "./takeUntil-zxKl50Ag.mjs";
|
|
4
|
+
import { t as o } from "./timer-BOeyNkh5.mjs";
|
|
5
|
+
import { t as s } from "./fromEvent-koPx2dM9.mjs";
|
|
6
|
+
import { t as c } from "./filter-LJ9oGNCV.mjs";
|
|
7
|
+
// ../../platforms/file-player/api/src/file-api.service.ts
|
|
8
|
+
var l = class {
|
|
9
|
+
constructor() {
|
|
10
|
+
this.urlRegexes = [/* @__PURE__ */ new RegExp(/(?<id>https?:\/\/.+\.(?<audiotype>mp4a|mpga|mp2a|weba|m4a|m4b|m2a|m3a|mp2|mp3|wav|aac|oga|spx))(?![a-z0-9])/, "g"), /* @__PURE__ */ new RegExp(/(?<id>https?:\/\/.+\.(?<videotype>webm|mp4|ogg|ogv|mov|m4v))(?![a-z0-9])/, "g")];
|
|
11
|
+
}
|
|
12
|
+
get id() {
|
|
13
|
+
return "file";
|
|
14
|
+
}
|
|
15
|
+
get canReusePlayer() {
|
|
16
|
+
return !1;
|
|
17
|
+
}
|
|
18
|
+
loadApi() {
|
|
19
|
+
return Promise.resolve();
|
|
20
|
+
}
|
|
21
|
+
match2id(e) {
|
|
22
|
+
if (!e.groups) throw "match2id - match.groups is undefined";
|
|
23
|
+
let t = e.groups.audiotype ? "audio" : e.groups.videotype ? "video" : "";
|
|
24
|
+
if (t === "") throw "Cannot match type";
|
|
25
|
+
return JSON.stringify({
|
|
26
|
+
tagType: t,
|
|
27
|
+
id: e.groups.id,
|
|
28
|
+
extension: e.groups.audiotype ?? e.groups.videotype
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
prepareHtml(e) {
|
|
32
|
+
if (!e.initialVideoId) throw "The File api requires an initial video id";
|
|
33
|
+
let t = JSON.parse(e.initialVideoId), n = t.id.replace(/["<>]/g, "");
|
|
34
|
+
switch (t.tagType) {
|
|
35
|
+
case "audio": return `
|
|
36
|
+
<div style="width:${e.width}px;height:${e.height}px;max-width:100%;overflow:hidden;position:relative;margin:0 auto">
|
|
37
|
+
<div style="height:100%;display:flex;width:100%;flex-direction:column;align-items:center;justify-content:space-around;position:absolute">
|
|
38
|
+
<audio src="${n}" ${e.autoplay ? "autoplay" : ""} controls="on" style="z-index:5;max-width:100%"></audio>
|
|
39
|
+
</div>
|
|
40
|
+
<div style="height:100%;display:flex;width:100%;flex-direction:column;align-items:center;justify-content:space-around;position:absolute">
|
|
41
|
+
<canvas width="${e.width}" height="${e.height}"></canvas>
|
|
42
|
+
</div>
|
|
43
|
+
</div>`;
|
|
44
|
+
case "video": return `<video src="${n}" style="max-width:100%" ${e.autoplay ? "autoplay" : ""} width="${e.width ?? 500}" height="${e.height ?? 300}" controls></video>`;
|
|
45
|
+
default: throw `Unsupported media type: ${t.extension}`;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
createPlayer(c, l) {
|
|
49
|
+
return new Promise((u, d) => {
|
|
50
|
+
if (!c.element) return d("The FilePlayer requires the options.element to be set");
|
|
51
|
+
let f = c.element.querySelector("audio, video");
|
|
52
|
+
if (!f) return d("There doesn't seem to be an audio or video element");
|
|
53
|
+
let p = c.element.querySelector("div"), m = new e(), h;
|
|
54
|
+
s(f, "canplay").pipe(i(1), a(m), a(l)).subscribe(() => {
|
|
55
|
+
if (h = n({
|
|
56
|
+
capabilities: [
|
|
57
|
+
r.volume,
|
|
58
|
+
r.mute,
|
|
59
|
+
r.fullscreen,
|
|
60
|
+
r.pictureInPicture
|
|
61
|
+
],
|
|
62
|
+
loadVideoById: (e) => {},
|
|
63
|
+
setPlayerState: (e) => {
|
|
64
|
+
switch (e) {
|
|
65
|
+
case t.playing:
|
|
66
|
+
f.play();
|
|
67
|
+
break;
|
|
68
|
+
case t.paused: f.pause();
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
setMute: (e) => f.muted = e,
|
|
72
|
+
setVolume: (e) => f.volume = e / 100,
|
|
73
|
+
setProgress: (e) => f.fastSeek(e),
|
|
74
|
+
setSize: (e, t) => {
|
|
75
|
+
f instanceof HTMLVideoElement && (f.width = e, f.height = t);
|
|
76
|
+
},
|
|
77
|
+
getTitle: () => new Promise((e, t) => {
|
|
78
|
+
t("File player doesn't support getting the title");
|
|
79
|
+
}),
|
|
80
|
+
setFullscreen: (e) => {
|
|
81
|
+
e ? p.requestFullscreen() : document.fullscreenElement === p && document.exitFullscreen();
|
|
82
|
+
},
|
|
83
|
+
getFullscreen: () => new Promise((e) => e(!1)),
|
|
84
|
+
setPip: (e) => {
|
|
85
|
+
f instanceof HTMLVideoElement && (e ? f.requestPictureInPicture() : document.pictureInPictureElement === f && document.exitPictureInPicture());
|
|
86
|
+
},
|
|
87
|
+
getPip: () => new Promise((e) => e(!1)),
|
|
88
|
+
destroy: () => {
|
|
89
|
+
f.pause(), f.removeAttribute("src"), f.load(), document.pictureInPictureElement === f && document.exitPictureInPicture(), m.next(!0);
|
|
90
|
+
}
|
|
91
|
+
}), f instanceof HTMLAudioElement) {
|
|
92
|
+
let e = c.element.getElementsByTagName("canvas");
|
|
93
|
+
e.length > 0 && this.createEqualizer(f, e[0], l), s(p, "fullscreenchange").pipe(a(m), a(l)).subscribe(() => h.onFullscreenChange(document.fullscreenElement === p));
|
|
94
|
+
} else s(f, "fullscreenchange").pipe(a(m), a(l)).subscribe(() => h.onFullscreenChange(document.fullscreenElement === f));
|
|
95
|
+
s(f, "volumechange").pipe(a(m), a(l)).subscribe(() => {
|
|
96
|
+
h.onVolumeChange(f.volume * 100), h.onMuteChange(f.muted);
|
|
97
|
+
}), s(f, "enterpictureinpicture").pipe(a(m), a(l)).subscribe(() => h.onPipChange(!0)), s(f, "leavepictureinpicture").pipe(a(m), a(l)).subscribe(() => h.onPipChange(!1)), s(f, "play").pipe(a(m), a(l)).subscribe(() => h.onStateChange(t.playing)), s(f, "pause").pipe(a(m), a(l)).subscribe(() => h.onStateChange(t.paused)), s(f, "ended").pipe(a(m), a(l)).subscribe(() => h.onStateChange(t.ended)), typeof window < "u" && o(0, 50).pipe(a(m), a(l)).subscribe(() => {
|
|
98
|
+
h.onCurrentTimeChange(f.currentTime), h.onDurationChange(f.duration);
|
|
99
|
+
}), setTimeout(() => {
|
|
100
|
+
h.onVolumeChange(f.volume * 100), h.onMuteChange(f.muted);
|
|
101
|
+
}, 20), u(h);
|
|
102
|
+
});
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
createEqualizer(e, t, n) {
|
|
106
|
+
let r = new AudioContext(), i = r.createAnalyser(), a = (e) => {
|
|
107
|
+
let t = Math.log(e / 4) / Math.log(2);
|
|
108
|
+
i.fftSize = 2 ** Math.round(t);
|
|
109
|
+
}, o = new ResizeObserver((e) => {
|
|
110
|
+
let t = e[0].contentRect.width;
|
|
111
|
+
a(t);
|
|
112
|
+
});
|
|
113
|
+
o.observe(t), a(t.width);
|
|
114
|
+
let s = r.createMediaElementSource(e);
|
|
115
|
+
s.connect(i), i.connect(r.destination), this.frameLooper(i, t, n);
|
|
116
|
+
let l = n.pipe(c((e) => e)).subscribe(() => {
|
|
117
|
+
i.disconnect(), s.disconnect(), r.close(), o.unobserve(t), l.unsubscribe();
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
frameLooper(e, t, n) {
|
|
121
|
+
let r = t.getContext("2d");
|
|
122
|
+
if (!r) throw "Could not get drawing context";
|
|
123
|
+
let i = !1, a = n.pipe(c((e) => e)).subscribe(() => {
|
|
124
|
+
i = !0, a.unsubscribe();
|
|
125
|
+
});
|
|
126
|
+
if (typeof window < "u") {
|
|
127
|
+
let n = window, a = (i) => {
|
|
128
|
+
n.RequestAnimationFrame = window.requestAnimationFrame(a) || n.msRequestAnimationFrame(a) || n.mozRequestAnimationFrame(a) || n.webkitRequestAnimationFrame(a);
|
|
129
|
+
let o = new Uint8Array(e.frequencyBinCount);
|
|
130
|
+
t.clientWidth / 4, e.getByteFrequencyData(o), r.clearRect(0, 0, t.width, t.height), r.fillStyle = "#888888";
|
|
131
|
+
for (let e = 0; e < o.length; e++) {
|
|
132
|
+
let n = e * t.clientWidth / o.length, i = -(o[e] / 2);
|
|
133
|
+
r.fillRect(n, t.height, 2, i);
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
i || a(0);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
export { l as FileApiService };
|
package/api-Bqn8VxG0.mjs
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { i as e, n as t, r as n, t as r } from "./src-BWj0KcGd.mjs";
|
|
2
|
+
import { t as i } from "./takeUntil-zxKl50Ag.mjs";
|
|
3
|
+
import { t as a } from "./timer-BOeyNkh5.mjs";
|
|
4
|
+
import { t as o } from "./src-C2Bgj48W.mjs";
|
|
5
|
+
// ../../platforms/youtube-player/api/src/youtube-api.service.ts
|
|
6
|
+
var s = o(), c = class {
|
|
7
|
+
constructor() {
|
|
8
|
+
this.urlRegexes = [
|
|
9
|
+
/* @__PURE__ */ new RegExp(/http[s]{0,1}:\/\/(www\.){0,1}youtube\.com\/watch\?v=(?<id>[^&]+)/, "g"),
|
|
10
|
+
/* @__PURE__ */ new RegExp(/http[s]{0,1}:\/\/m\.youtube\.com\/watch\?v=(?<id>[^&]+)/, "g"),
|
|
11
|
+
/* @__PURE__ */ new RegExp(/http[s]{0,1}:\/\/(www\.){0,1}youtu\.be\/(?<id>[^&?]+)/, "g"),
|
|
12
|
+
/* @__PURE__ */ new RegExp(/http[s]{0,1}:\/\/(www\.){0,1}youtube\.com\/shorts\/(?<id>[^&?]+)/, "g"),
|
|
13
|
+
/* @__PURE__ */ new RegExp(/http[s]{0,1}:\/\/m\.youtube\.com\/shorts\/(?<id>[^&?]+)/, "g"),
|
|
14
|
+
/* @__PURE__ */ new RegExp(/http[s]{0,1}:\/\/(www\.){0,1}youtube\.com\/live\/(?<id>[^&?]+)/, "g")
|
|
15
|
+
];
|
|
16
|
+
}
|
|
17
|
+
get id() {
|
|
18
|
+
return "youtube";
|
|
19
|
+
}
|
|
20
|
+
loadApi() {
|
|
21
|
+
return (0, s.loadScript)("https://www.youtube.com/iframe_api", { windowCallback: "onYouTubeIframeAPIReady" });
|
|
22
|
+
}
|
|
23
|
+
prepareHtml(e) {
|
|
24
|
+
return `<div id="${e.domId}" style="max-width:100%"></div>`;
|
|
25
|
+
}
|
|
26
|
+
createPlayer(o, s) {
|
|
27
|
+
return new Promise((c, l) => {
|
|
28
|
+
if (!o.domId) return l("The YouTube api requires the options.domId to be set");
|
|
29
|
+
let u = new e(), d, f = new YT.Player(o.domId, {
|
|
30
|
+
width: o.width,
|
|
31
|
+
height: o.height,
|
|
32
|
+
playerVars: {
|
|
33
|
+
fs: 1,
|
|
34
|
+
autoplay: o.autoplay
|
|
35
|
+
},
|
|
36
|
+
events: {
|
|
37
|
+
onReady: (e) => {
|
|
38
|
+
d = n({
|
|
39
|
+
capabilities: [
|
|
40
|
+
r.volume,
|
|
41
|
+
r.mute,
|
|
42
|
+
r.getTitle
|
|
43
|
+
],
|
|
44
|
+
loadVideoById: (e) => {
|
|
45
|
+
o.autoplay ? f.loadVideoById(e) : f.cueVideoById(e);
|
|
46
|
+
},
|
|
47
|
+
setPlayerState: (e) => {
|
|
48
|
+
switch (e) {
|
|
49
|
+
case t.playing:
|
|
50
|
+
f.playVideo();
|
|
51
|
+
break;
|
|
52
|
+
case t.paused:
|
|
53
|
+
f.pauseVideo();
|
|
54
|
+
break;
|
|
55
|
+
case t.ended:
|
|
56
|
+
f.stopVideo();
|
|
57
|
+
break;
|
|
58
|
+
case t.unstarted:
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
setMute: (e) => e ? f.mute() : f.unMute(),
|
|
62
|
+
setVolume: (e) => f.setVolume(e),
|
|
63
|
+
setProgress: (e) => f.seekTo(e, !0),
|
|
64
|
+
setSize: (e, t) => f.setSize(e, t),
|
|
65
|
+
getTitle: () => new Promise((e) => {
|
|
66
|
+
e(f.getVideoData().title);
|
|
67
|
+
}),
|
|
68
|
+
setFullscreen: (e) => {
|
|
69
|
+
e && (console.warn("YouTube player doesn't allow setting fullscreen from outside"), setTimeout(() => d.onFullscreenChange(!1), 50));
|
|
70
|
+
},
|
|
71
|
+
getFullscreen: () => new Promise((e) => {
|
|
72
|
+
console.warn("YouTube player doesn't allow setting fullscreen from outside"), e(!1);
|
|
73
|
+
}),
|
|
74
|
+
setPip: (e) => {
|
|
75
|
+
e && (console.warn("YouTube player doesn't support PIP mode"), setTimeout(() => d.onPipChange(!1), 50));
|
|
76
|
+
},
|
|
77
|
+
getPip: () => new Promise((e) => e(!1)),
|
|
78
|
+
destroy: () => {
|
|
79
|
+
u.next(!0), f.destroy();
|
|
80
|
+
}
|
|
81
|
+
}), typeof window < "u" && a(0, 50).pipe(i(u), i(s)).subscribe(() => {
|
|
82
|
+
let e = f.getCurrentTime();
|
|
83
|
+
d.onCurrentTimeChange(e);
|
|
84
|
+
let t = f.getVolume();
|
|
85
|
+
d.onVolumeChange(t);
|
|
86
|
+
let n = f.isMuted();
|
|
87
|
+
d.onMuteChange(n);
|
|
88
|
+
}), c(d);
|
|
89
|
+
},
|
|
90
|
+
onStateChange: (e) => {
|
|
91
|
+
switch (e.data) {
|
|
92
|
+
case YT.PlayerState.PLAYING: return d.onDurationChange(f.getDuration()), d.onStateChange(t.playing);
|
|
93
|
+
case YT.PlayerState.PAUSED: return d.onStateChange(t.paused);
|
|
94
|
+
case YT.PlayerState.ENDED: return d.onStateChange(t.ended);
|
|
95
|
+
case YT.PlayerState.UNSTARTED: return d.onStateChange(t.unstarted);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
export { c as YoutubeApiService };
|
package/api-BvYiv0Ae.mjs
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { i as e, n as t, r as n, t as r } from "./src-BWj0KcGd.mjs";
|
|
2
|
+
import { t as i } from "./filter-LJ9oGNCV.mjs";
|
|
3
|
+
import { t as a } from "./src-C2Bgj48W.mjs";
|
|
4
|
+
// ../../platforms/wistia-player/api/src/services/wistia.service.ts
|
|
5
|
+
var o = a(), s = class {
|
|
6
|
+
constructor() {
|
|
7
|
+
this.urlRegexes = [/* @__PURE__ */ new RegExp(/https?:\/\/(www\.|home\.|fast\.)?wistia\.(com|net)\/(medias|embed)\/(iframe\/)?(?<id>[0-9A-Za-z]+)/)];
|
|
8
|
+
}
|
|
9
|
+
get id() {
|
|
10
|
+
return "wistia";
|
|
11
|
+
}
|
|
12
|
+
loadApi() {
|
|
13
|
+
return (0, o.loadScript)("https://fast.wistia.com/assets/external/E-v1.js", { async: !0 });
|
|
14
|
+
}
|
|
15
|
+
prepareHtml(e) {
|
|
16
|
+
if (!e.domId) throw "The Wistia api requires the options.domId to be set";
|
|
17
|
+
if (!e.initialVideoId) throw "The Wistia api requires an initial video id";
|
|
18
|
+
return `<div id="${e.domId}" key="${e.initialVideoId}" class="wistia_embed wistia_async_${e.initialVideoId}" style="width:${e.width ?? 640}px;height:${e.height ?? 360}px;max-width:100%"></div>`;
|
|
19
|
+
}
|
|
20
|
+
get canReusePlayer() {
|
|
21
|
+
return !1;
|
|
22
|
+
}
|
|
23
|
+
createPlayer(a, o) {
|
|
24
|
+
return new Promise((s, c) => {
|
|
25
|
+
if (typeof window > "u") return;
|
|
26
|
+
if (!a.domId) return c("The Wistia api requires the options.domId to be set");
|
|
27
|
+
if (!a.initialVideoId) return c("The Wistia implementation requires an initial video");
|
|
28
|
+
let l = window._wq = window._wq || [], u = {
|
|
29
|
+
id: a.domId,
|
|
30
|
+
onReady: (c) => {
|
|
31
|
+
let d = new e(), f = !1, p, m = n({
|
|
32
|
+
capabilities: [
|
|
33
|
+
r.mute,
|
|
34
|
+
r.volume,
|
|
35
|
+
r.fullscreen,
|
|
36
|
+
r.getTitle
|
|
37
|
+
],
|
|
38
|
+
loadVideoById: (e) => {
|
|
39
|
+
c.addToPlaylist(e), a.autoplay && setTimeout(() => c.play(), 20), m.onVolumeChange(c.volume() * 100);
|
|
40
|
+
},
|
|
41
|
+
setPlayerState: (e) => {
|
|
42
|
+
switch (e) {
|
|
43
|
+
case t.playing:
|
|
44
|
+
c.play();
|
|
45
|
+
break;
|
|
46
|
+
case t.paused: c.pause();
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
setMute: (e) => {
|
|
50
|
+
e ? c.mute() : c.unmute();
|
|
51
|
+
},
|
|
52
|
+
setVolume: (e) => c.volume(e / 100),
|
|
53
|
+
setProgress: (e) => c.time(e),
|
|
54
|
+
setSize: (e, t) => {
|
|
55
|
+
c.width(e), c.height(t);
|
|
56
|
+
},
|
|
57
|
+
getTitle: () => new Promise((e) => e(c.name())),
|
|
58
|
+
setFullscreen: (e) => {
|
|
59
|
+
e ? c.requestFullscreen() : c.cancelFullscreen();
|
|
60
|
+
},
|
|
61
|
+
getFullscreen: () => new Promise((e) => e(c.inFullscreen())),
|
|
62
|
+
setPip: (e) => {
|
|
63
|
+
e && (console.warn("Wistia player doesn't support PIP mode"), setTimeout(() => m.onPipChange(!1), 50));
|
|
64
|
+
},
|
|
65
|
+
getPip: () => new Promise((e) => e(!1)),
|
|
66
|
+
destroy: () => {
|
|
67
|
+
f || (f = !0, p?.unsubscribe(), c.unbind("play", h.get("play")), c.unbind("pause", h.get("pause")), c.unbind("end", h.get("end")), c.unbind("mutechange", h.get("mutechange")), c.unbind("volumechange", h.get("volumechange")), c.unbind("timechange", h.get("timechange")), c.unbind("enterfullscreen", h.get("enterfullscreen")), c.unbind("cancelfullscreen", h.get("cancelfullscreen")), c.remove(), d.next(!0), l.push({ revoke: u }));
|
|
68
|
+
}
|
|
69
|
+
}), h = /* @__PURE__ */ new Map();
|
|
70
|
+
h.set("play", () => {
|
|
71
|
+
m.onStateChange(t.playing), m.onDurationChange(c.duration());
|
|
72
|
+
}), h.set("pause", () => m.onStateChange(t.paused)), h.set("end", () => m.onStateChange(t.ended)), h.set("volumechange", (e) => m.onVolumeChange(e * 100)), h.set("timechange", (e) => m.onCurrentTimeChange(e)), h.set("mutechange", (e) => m.onMuteChange(e)), h.set("enterfullscreen", () => m.onFullscreenChange(!0)), h.set("cancelfullscreen", () => m.onFullscreenChange(!1)), c.bind("play", h.get("play")), c.bind("pause", h.get("pause")), c.bind("end", h.get("end")), c.bind("timechange", h.get("timechange")), c.bind("mutechange", h.get("mutechange")), c.bind("volumechange", h.get("volumechange")), c.bind("enterfullscreen", h.get("enterfullscreen")), c.bind("cancelfullscreen", h.get("cancelfullscreen")), p = o.pipe(i((e) => e)).subscribe(() => m.destroy()), s(m);
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
l.push(u);
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
export { s as WistiaService };
|
package/api-C-ycGc3Y.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("./src-CluKb0O6.js"),t=require("./BehaviorSubject-B43NQ6Ep.js"),n=require("./take-BVSpP1qC.js"),r=require("./debounceTime-B4ed_w3_.js"),i=require("./takeUntil-MRP2QN5v.js"),a=require("./timer-mrjvJwyN.js"),o=require("./filter-Ck2Y29AT.js"),s=require("./pairwise-ksRX5aBP.js"),c=require("./src-CYCud0_r.js");function l(t){return t===void 0&&(t=1/0),n.n(e.c,t)}function u(){return l(1)}function d(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return u()(r.r(e,r.i(e)))}function f(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var i=r.i(t);return e.o(function(e,n){(i?d(t,e,i):d(t,e)).subscribe(n)})}var p=c.t(),m=class{constructor(){this.urlRegexes=[new RegExp(/^(?<id>https?:\/\/(www\.)?facebook\.com\/(?<user>[^/?]+)\/videos\/(?<video>[0-9]+)[/?]*)/,`g`),new RegExp(/^(?<id>https?:\/\/(www\.)?facebook\.com\/watch\/\?v=[0-9]+)/,`g`)]}get id(){return`facebook`}get canReusePlayer(){return!1}loadApi(){return(0,p.loadScript)(`https://connect.facebook.net/en_US/sdk.js#xfbml=1&version=v3.0`,{windowCallback:`fbAsyncInit`})}prepareHtml(e){if(!e.initialVideoId)throw`The Facebook api requires an initial video id`;if(/[\s<>"]/.exec(e.initialVideoId))throw`The url contains invalid characters:\n${e.initialVideoId}`;return`<div id="${e.domId}" class="fb-video" data-href="${e.initialVideoId}" data-width="${e.width}" data-height="${e.height}" data-autoplay="true" data-allowfullscreen="true" data-controls="true"></div>`}createPlayer(c,l){return new Promise((u,d)=>{let p=new t.t(void 0),m,h=!1,g=new e.i;FB.init({xfbml:!0,version:`v2.5`}),FB.Event.subscribe(`xfbml.ready`,e=>{e.type===`video`&&e.id===c.domId&&p.next(e.instance)});let _=e.r({capabilities:[e.t.mute,e.t.volume],loadVideoById:e=>{},setPlayerState:t=>{let n=p.value;switch(t){case e.n.playing:n&&(_.onDurationChange(n.getDuration()),n.play());break;case e.n.paused:n&&n.pause()}},setMute:e=>{let t=p.value;t&&(h=!0,e?t.mute():t.unmute(),setTimeout(()=>h=!1,20))},setVolume:e=>{let t=p.value;!h&&t&&t.setVolume(e/100)},setProgress:e=>{let t=p.value;t&&t.seek(e)},setSize:(e,t)=>{},getTitle:()=>new Promise((e,t)=>t(`The Facebook player doesn't allow getting the title`)),setFullscreen:e=>{throw`The Facebook player doesn't allow fullscreen mode`},getFullscreen:()=>new Promise(e=>e(!1)),setPip:e=>{throw`The Facebook player doesn't allow PiP mode`},getPip:()=>new Promise(e=>e(!1)),destroy:()=>{m&&m.forEach(e=>e.release()),g.next(!0)}});p.pipe(r.t(500),f(void 0),s.t()).subscribe(([t,n])=>{t&&m&&m.forEach(e=>e.release()),n&&(m=[n.subscribe(`startedPlaying`,()=>_.onStateChange(e.n.playing)),n.subscribe(`paused`,()=>_.onStateChange(e.n.paused)),n.subscribe(`finishedPlaying`,()=>_.onStateChange(e.n.ended))])}),typeof window<`u`&&r.n([p.pipe(r.t(500)),a.t(0,50)]).pipe(o.t(([e])=>!!e)).pipe(i.t(g),i.t(l)).subscribe(([e])=>{if(e){let t=e.getCurrentPosition();if(_.onCurrentTimeChange(t),!h){let t=e.getVolume();e.isMuted()&&t===0||_.onVolumeChange(t*100)}let n=e.isMuted();_.onMuteChange(n)}}),p.pipe(r.t(1500),o.t(e=>!!e),n.t(1),i.t(l)).subscribe(e=>{c.autoplay&&e&&setTimeout(()=>e.play(),50)}),u(_)})}};exports.FacebookApiService=m;
|