@opendesign-plus-test/components 0.0.1-rc.211 → 0.0.1-rc.212
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent, ref, computed, watchEffect,
|
|
1
|
+
import { defineComponent, ref, watch, computed, watchEffect, nextTick, onMounted, onUnmounted, openBlock, createElementBlock, createElementVNode, createVNode, withCtx, createTextVNode, toDisplayString, createBlock, unref, Fragment, renderList, createCommentVNode, normalizeClass, normalizeStyle, renderSlot } from "vue";
|
|
2
2
|
import { transformSeconds, speakerNum, transformTime } from "./utils.mjs";
|
|
3
3
|
import { OSelect, OOption, OTab, OTabPane, OScroller, OIcon, OIconChevronDown } from "@opensig/opendesign";
|
|
4
4
|
import _sfc_main$3 from "./components/OMeetingPlaybackSubtitles.vue.mjs";
|
|
@@ -57,6 +57,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
57
57
|
const setTrackIdx = (idx) => {
|
|
58
58
|
trackIdx.value = idx;
|
|
59
59
|
};
|
|
60
|
+
watch(
|
|
61
|
+
() => props.data,
|
|
62
|
+
() => {
|
|
63
|
+
trackIdx.value = 0;
|
|
64
|
+
}
|
|
65
|
+
);
|
|
60
66
|
const captionsList = ref([]);
|
|
61
67
|
const getCaptions = async (url) => {
|
|
62
68
|
const res = await fetch(url);
|
|
@@ -261,7 +267,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
261
267
|
]),
|
|
262
268
|
createElementVNode("div", _hoisted_4, [
|
|
263
269
|
__props.data ? (openBlock(), createBlock(_sfc_main$2, {
|
|
264
|
-
key:
|
|
270
|
+
key: 0,
|
|
265
271
|
ref_key: "playerRef",
|
|
266
272
|
ref: playerRef,
|
|
267
273
|
src: __props.data.video,
|
|
@@ -96,6 +96,47 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
96
96
|
);
|
|
97
97
|
const loaded = ref(false);
|
|
98
98
|
const playStatus = ref("init");
|
|
99
|
+
const updateSource = () => {
|
|
100
|
+
const player = playerRef.value;
|
|
101
|
+
if (!player || !props.src) return;
|
|
102
|
+
player.src(props.src);
|
|
103
|
+
player.poster(props.poster || defaultPoster);
|
|
104
|
+
const oldTracks = player.remoteTextTracks();
|
|
105
|
+
for (let i = oldTracks.length - 1; i >= 0; i--) {
|
|
106
|
+
player.removeRemoteTextTrack(oldTracks[i]);
|
|
107
|
+
}
|
|
108
|
+
if (props.vtt) {
|
|
109
|
+
player.addRemoteTextTrack({
|
|
110
|
+
kind: "subtitles",
|
|
111
|
+
src: props.vtt,
|
|
112
|
+
srclang: "zh",
|
|
113
|
+
label: "中文",
|
|
114
|
+
default: false
|
|
115
|
+
});
|
|
116
|
+
const textTracks = player.textTracks();
|
|
117
|
+
for (let i = 0; i < textTracks.length; i++) {
|
|
118
|
+
const textTrack = textTracks[i];
|
|
119
|
+
textTrack == null ? void 0 : textTrack.addEventListener("cuechange", () => {
|
|
120
|
+
handleCue(textTrack);
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
playStatus.value = "init";
|
|
125
|
+
checkedSpeakers.value = [];
|
|
126
|
+
syncSubtitleBtn(player);
|
|
127
|
+
};
|
|
128
|
+
const syncSubtitleBtn = (player) => {
|
|
129
|
+
var _a, _b;
|
|
130
|
+
const btn = (_b = (_a = player.controlBar) == null ? void 0 : _a.getChild) == null ? void 0 : _b.call(_a, "SubtitleToggleButton");
|
|
131
|
+
if (!btn) return;
|
|
132
|
+
if (props.vtt) {
|
|
133
|
+
btn.show();
|
|
134
|
+
} else {
|
|
135
|
+
btn.hide();
|
|
136
|
+
btn.removeClass("vjs-subtitle-showing");
|
|
137
|
+
btn.addClass("vjs-subtitle-hidden");
|
|
138
|
+
}
|
|
139
|
+
};
|
|
99
140
|
const videoInit = async () => {
|
|
100
141
|
if (!props.src) return;
|
|
101
142
|
const player = videojs("playerId", {
|
|
@@ -131,15 +172,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
131
172
|
}
|
|
132
173
|
}
|
|
133
174
|
});
|
|
175
|
+
playerRef.value = player;
|
|
134
176
|
emits("getInstance", player);
|
|
135
|
-
|
|
136
|
-
player.addRemoteTextTrack({
|
|
137
|
-
kind: "subtitles",
|
|
138
|
-
src: props.vtt,
|
|
139
|
-
srclang: "zh",
|
|
140
|
-
label: "中文",
|
|
141
|
-
default: false
|
|
142
|
-
});
|
|
177
|
+
updateSource();
|
|
143
178
|
loaded.value = true;
|
|
144
179
|
class CustomSubsCapsButton extends videojs.getComponent("Button") {
|
|
145
180
|
constructor(player2, options) {
|
|
@@ -167,18 +202,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
167
202
|
}
|
|
168
203
|
}
|
|
169
204
|
}
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
player.controlBar.addChild("SubtitleToggleButton", {}, 8);
|
|
174
|
-
}
|
|
205
|
+
videojs.registerComponent("SubtitleToggleButton", CustomSubsCapsButton);
|
|
206
|
+
if (!player.controlBar.children_.some((v) => v.name_ === "SubtitleToggleButton")) {
|
|
207
|
+
player.controlBar.addChild("SubtitleToggleButton", {}, 8);
|
|
175
208
|
}
|
|
176
|
-
|
|
177
|
-
textTracks.forEach((textTrack) => {
|
|
178
|
-
textTrack == null ? void 0 : textTrack.addEventListener("cuechange", () => {
|
|
179
|
-
handleCue(textTrack);
|
|
180
|
-
});
|
|
181
|
-
});
|
|
209
|
+
syncSubtitleBtn(player);
|
|
182
210
|
player.on("play", () => {
|
|
183
211
|
playStatus.value = "playing";
|
|
184
212
|
});
|
|
@@ -190,28 +218,35 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
190
218
|
});
|
|
191
219
|
emits("setTrackIdx", idx);
|
|
192
220
|
});
|
|
193
|
-
player.
|
|
221
|
+
player.on("loadedmetadata", () => {
|
|
194
222
|
emits("getDuration", player.duration());
|
|
195
223
|
});
|
|
196
224
|
nextTick(() => {
|
|
197
225
|
const container = document.getElementsByClassName("o-meeting-playback-video")[0];
|
|
198
226
|
colHeight.value = container.offsetHeight;
|
|
199
227
|
});
|
|
200
|
-
playerRef.value = player;
|
|
201
228
|
};
|
|
202
229
|
onMounted(() => {
|
|
203
230
|
videoInit();
|
|
204
231
|
document.addEventListener("click", closeSpeakerMenu);
|
|
205
232
|
});
|
|
206
233
|
watch(
|
|
207
|
-
() => props.src,
|
|
234
|
+
() => [props.src, props.vtt, props.poster],
|
|
208
235
|
() => {
|
|
209
|
-
|
|
236
|
+
if (!playerRef.value) {
|
|
237
|
+
videoInit();
|
|
238
|
+
} else {
|
|
239
|
+
updateSource();
|
|
240
|
+
}
|
|
210
241
|
}
|
|
211
242
|
);
|
|
212
243
|
onUnmounted(() => {
|
|
213
244
|
var _a;
|
|
214
|
-
(
|
|
245
|
+
if (playerRef.value) {
|
|
246
|
+
playerRef.value.dispose();
|
|
247
|
+
} else {
|
|
248
|
+
(_a = props == null ? void 0 : props.instance) == null ? void 0 : _a.dispose();
|
|
249
|
+
}
|
|
215
250
|
document.removeEventListener("click", closeSpeakerMenu);
|
|
216
251
|
});
|
|
217
252
|
__expose({
|