hy-dispatch-ui-v3 0.1.6 → 0.2.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/README.md +47 -0
- package/dist/tailwind.css +349 -4
- package/es/components/appAudioPlayer/appAudioPlayer.vue.mjs +462 -0
- package/es/components/appAudioPlayer/index.mjs +6 -0
- package/es/components/appAudioPlayer/js/index.mjs +327 -0
- package/es/components/appAudioPlayer/style/appAudioPlayer.scss +319 -0
- package/es/components/appButton/style/appButton.scss +0 -1
- package/es/components/appConfigProvider/appConfigProvider.vue.mjs +22 -1
- package/es/components/appCutter/appCutter.vue.mjs +202 -129
- package/es/components/appDatePicker/appDatePicker.vue.mjs +1 -1
- package/es/components/appForm/appForm.vue.mjs +132 -209
- package/es/components/appForm/cpns/appFormItem.vue.mjs +312 -0
- package/es/components/appForm/cpns/arrayItem.vue.mjs +305 -0
- package/es/components/appForm/cpns/extraItem.vue.mjs +140 -0
- package/es/components/appForm/js/index.mjs +46 -24
- package/es/components/appForm/js/useAppForm.mjs +30 -6
- package/es/components/appForm/style/appForm.scss +53 -0
- package/es/components/appIcon/appIcon.vue.mjs +2 -1
- package/es/components/appIconBox/style/appIconBox.scss +0 -1
- package/es/components/appInput/appInput.vue.mjs +99 -0
- package/es/components/appInput/index.mjs +6 -0
- package/es/components/appMenu/appMenu.vue.mjs +129 -0
- package/es/components/appMenu/index.mjs +6 -0
- package/es/components/appMenu/style/appMenu.scss +145 -0
- package/es/components/appOrgCascader/appOrgCascader.vue.mjs +14 -10
- package/es/components/appSearch/appSearch.vue.mjs +55 -211
- package/es/components/appSearch/cpns/appSearchItem.vue.mjs +238 -0
- package/es/components/appSearch/js/index.mjs +20 -8
- package/es/components/appSearch/js/useAppSearch.mjs +10 -5
- package/es/components/appSearch/style/appSearch.scss +10 -0
- package/es/components/appTable/appTable.vue.mjs +312 -158
- package/es/components/appTable/cpns/columnSelect.vue.mjs +151 -156
- package/es/components/appTable/cpns/columnSelectItem.vue2.mjs +104 -110
- package/es/components/appTable/cpns/headerItem.vue.mjs +98 -0
- package/es/components/appTable/cpns/virtualTable.vue.mjs +560 -0
- package/es/components/appTable/js/index.mjs +46 -20
- package/es/components/appTable/js/search.mjs +1 -2
- package/es/components/appTable/js/useAppTable.mjs +58 -14
- package/es/components/appTable/style/appTable.scss +16 -0
- package/es/components/appTooltip/appTooltip.vue.mjs +24 -13
- package/es/components/appTree/appTree.vue.mjs +304 -0
- package/es/components/appTree/index.mjs +6 -0
- package/es/components/appTree/js/index.mjs +531 -0
- package/es/components/appUserAvatar/appUserAvatar.vue.mjs +9 -8
- package/es/components/appUserAvatar/style/appUserAvatar.scss +0 -1
- package/es/components/appVideoPlayer/appVideoPlayer.vue.mjs +647 -0
- package/es/components/appVideoPlayer/cpns/mediaLoading.vue.mjs +35 -0
- package/es/components/appVideoPlayer/index.mjs +6 -0
- package/es/components/appVideoPlayer/js/index.mjs +426 -0
- package/es/components/appVideoPlayer/style/appVideoPlayer.scss +275 -0
- package/es/components/appVideoPlayer/style/mediaLoading.scss +62 -0
- package/es/components/index.mjs +5 -0
- package/es/hooks/index.mjs +3 -0
- package/es/hooks/useApi.mjs +4 -4
- package/es/hooks/useAudioPlayerConfig.mjs +12 -0
- package/es/hooks/useGlobalConfig.mjs +18 -7
- package/es/hooks/useLocale.mjs +3 -11
- package/es/hooks/useMixins.mjs +1 -1
- package/es/hooks/usePermissionMap.mjs +12 -0
- package/es/hooks/useUserAvatarMap.mjs +2 -3
- package/es/hooks/useVideoPlayerConfig.mjs +12 -0
- package/es/index.mjs +14 -4
- package/es/locale/en.mjs +52 -3
- package/es/locale/zh_CN.mjs +48 -3
- package/es/make-installer.mjs +2 -0
- package/es/static/hy-svg-icons.js +462 -0
- package/es/static/protocolcheck.js +247 -0
- package/es/style/element/element.scss +9 -0
- package/es/style/element/index.scss +6 -3
- package/es/style/index.scss +11 -0
- package/es/style/theme.scss +73 -0
- package/es/utils/date.mjs +25 -1
- package/es/utils/file.mjs +5 -4
- package/es/utils/form.mjs +52 -0
- package/es/utils/handler.mjs +22 -2
- package/es/utils/index.mjs +6 -4
- package/es/utils/is.mjs +23 -2
- package/es/utils/loadScript.mjs +33 -0
- package/es/version.mjs +1 -1
- package/lib/components/appAudioPlayer/appAudioPlayer.vue.js +466 -0
- package/lib/components/appAudioPlayer/index.js +11 -0
- package/lib/components/appAudioPlayer/js/index.js +329 -0
- package/lib/components/appAudioPlayer/style/appAudioPlayer.scss +319 -0
- package/lib/components/appButton/style/appButton.scss +0 -1
- package/lib/components/appConfigProvider/appConfigProvider.vue.js +22 -1
- package/lib/components/appCutter/appCutter.vue.js +201 -128
- package/lib/components/appDatePicker/appDatePicker.vue.js +1 -1
- package/lib/components/appForm/appForm.vue.js +129 -206
- package/lib/components/appForm/cpns/appFormItem.vue.js +316 -0
- package/lib/components/appForm/cpns/arrayItem.vue.js +309 -0
- package/lib/components/appForm/cpns/extraItem.vue.js +144 -0
- package/lib/components/appForm/js/index.js +48 -23
- package/lib/components/appForm/js/useAppForm.js +30 -6
- package/lib/components/appForm/style/appForm.scss +53 -0
- package/lib/components/appIcon/appIcon.vue.js +2 -1
- package/lib/components/appIconBox/style/appIconBox.scss +0 -1
- package/lib/components/appInput/appInput.vue.js +103 -0
- package/lib/components/appInput/index.js +11 -0
- package/lib/components/appMenu/appMenu.vue.js +133 -0
- package/lib/components/appMenu/index.js +11 -0
- package/lib/components/appMenu/style/appMenu.scss +145 -0
- package/lib/components/appOrgCascader/appOrgCascader.vue.js +14 -10
- package/lib/components/appSearch/appSearch.vue.js +51 -207
- package/lib/components/appSearch/cpns/appSearchItem.vue.js +242 -0
- package/lib/components/appSearch/js/index.js +20 -7
- package/lib/components/appSearch/js/useAppSearch.js +10 -5
- package/lib/components/appSearch/style/appSearch.scss +10 -0
- package/lib/components/appTable/appTable.vue.js +319 -165
- package/lib/components/appTable/cpns/columnSelect.vue.js +151 -156
- package/lib/components/appTable/cpns/columnSelectItem.vue2.js +105 -111
- package/lib/components/appTable/cpns/headerItem.vue.js +102 -0
- package/lib/components/appTable/cpns/virtualTable.vue.js +564 -0
- package/lib/components/appTable/js/index.js +47 -19
- package/lib/components/appTable/js/search.js +1 -2
- package/lib/components/appTable/js/useAppTable.js +57 -13
- package/lib/components/appTable/style/appTable.scss +16 -0
- package/lib/components/appTooltip/appTooltip.vue.js +23 -12
- package/lib/components/appTree/appTree.vue.js +308 -0
- package/lib/components/appTree/index.js +11 -0
- package/lib/components/appTree/js/index.js +533 -0
- package/lib/components/appUserAvatar/appUserAvatar.vue.js +9 -8
- package/lib/components/appUserAvatar/style/appUserAvatar.scss +0 -1
- package/lib/components/appVideoPlayer/appVideoPlayer.vue.js +651 -0
- package/lib/components/appVideoPlayer/cpns/mediaLoading.vue.js +39 -0
- package/lib/components/appVideoPlayer/index.js +11 -0
- package/lib/components/appVideoPlayer/js/index.js +429 -0
- package/lib/components/appVideoPlayer/style/appVideoPlayer.scss +275 -0
- package/lib/components/appVideoPlayer/style/mediaLoading.scss +62 -0
- package/lib/components/index.js +42 -32
- package/lib/hooks/index.js +9 -0
- package/lib/hooks/useApi.js +4 -4
- package/lib/hooks/useAudioPlayerConfig.js +15 -0
- package/lib/hooks/useGlobalConfig.js +18 -7
- package/lib/hooks/useLocale.js +3 -11
- package/lib/hooks/useMixins.js +1 -1
- package/lib/hooks/usePermissionMap.js +15 -0
- package/lib/hooks/useUserAvatarMap.js +1 -2
- package/lib/hooks/useVideoPlayerConfig.js +15 -0
- package/lib/index.js +62 -33
- package/lib/locale/en.js +52 -3
- package/lib/locale/zh_CN.js +48 -3
- package/lib/make-installer.js +2 -0
- package/lib/static/hy-svg-icons.js +459 -8
- package/lib/static/protocolcheck.js +249 -0
- package/lib/style/element/element.scss +9 -0
- package/lib/style/element/index.scss +6 -3
- package/lib/style/index.scss +11 -0
- package/lib/style/theme.scss +73 -0
- package/lib/utils/date.js +25 -0
- package/lib/utils/file.js +4 -4
- package/lib/utils/form.js +57 -0
- package/lib/utils/handler.js +22 -1
- package/lib/utils/index.js +11 -1
- package/lib/utils/is.js +23 -1
- package/lib/utils/loadScript.js +37 -0
- package/lib/version.js +1 -1
- package/package.json +12 -10
- package/es/config/index.mjs +0 -1
- package/es/static/hy-svg-icons.mjs +0 -11
- package/lib/config/index.js +0 -2
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var appVideoPlayer = require('./appVideoPlayer.vue.js');
|
|
6
|
+
var handler = require('../../utils/handler.js');
|
|
7
|
+
|
|
8
|
+
const AppVideoPlayer = handler.withInstall(appVideoPlayer.default);
|
|
9
|
+
|
|
10
|
+
exports.AppVideoPlayer = AppVideoPlayer;
|
|
11
|
+
exports.default = AppVideoPlayer;
|
|
@@ -0,0 +1,429 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var vue = require('vue');
|
|
4
|
+
var elementPlus = require('element-plus');
|
|
5
|
+
var useVideoPlayerConfig = require('../../../hooks/useVideoPlayerConfig.js');
|
|
6
|
+
var date = require('../../../utils/date.js');
|
|
7
|
+
var index = require('../../appConfirmDialog/index.js');
|
|
8
|
+
var handler = require('../../../utils/handler.js');
|
|
9
|
+
var is = require('../../../utils/is.js');
|
|
10
|
+
var useLocale = require('../../../hooks/useLocale.js');
|
|
11
|
+
|
|
12
|
+
const useVideoPlayer = (hy) => {
|
|
13
|
+
const { props, emits, videoRef } = hy;
|
|
14
|
+
const { t } = useLocale.useLocale();
|
|
15
|
+
const { videoPlayerConfig } = useVideoPlayerConfig.useVideoPlayerConfig();
|
|
16
|
+
const speed = vue.ref(1);
|
|
17
|
+
const playRules = vue.ref(1);
|
|
18
|
+
const loading = vue.ref(false);
|
|
19
|
+
const videoItem = vue.ref({});
|
|
20
|
+
const videoUrl = vue.ref("");
|
|
21
|
+
const totalTime = vue.ref(0);
|
|
22
|
+
const curTime = vue.ref(0);
|
|
23
|
+
const progress = vue.ref(0);
|
|
24
|
+
const isDrop = vue.ref(false);
|
|
25
|
+
const isFullScreen = vue.ref(false);
|
|
26
|
+
const volumeValue = vue.ref(100);
|
|
27
|
+
const hasVLC = vue.ref(true);
|
|
28
|
+
const isCanNotPlayType = vue.ref(true);
|
|
29
|
+
const videoState = vue.ref("NO_LOAD");
|
|
30
|
+
const speedList = [
|
|
31
|
+
{ value: 0.5, label: "0.5 X" },
|
|
32
|
+
{ value: 1, label: "1.0 X" },
|
|
33
|
+
{ value: 1.5, label: "1.5 X" },
|
|
34
|
+
{ value: 2, label: "2.0 X" },
|
|
35
|
+
{ value: 3, label: "3.0 X" }
|
|
36
|
+
];
|
|
37
|
+
const playRulesList = [
|
|
38
|
+
{
|
|
39
|
+
value: 1,
|
|
40
|
+
label: t("videoPlayer.stopAfterPlayback"),
|
|
41
|
+
svgName: "player-mediaCenter_stopPlaying"
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
value: 2,
|
|
45
|
+
label: t("videoPlayer.continuousPlayback"),
|
|
46
|
+
svgName: "player-mediaCenter_autoplay"
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
value: 3,
|
|
50
|
+
label: t("videoPlayer.loopPlayback"),
|
|
51
|
+
svgName: "player-mediaCenter_loopPlayback"
|
|
52
|
+
}
|
|
53
|
+
];
|
|
54
|
+
const isAnalyseType = vue.computed(() => {
|
|
55
|
+
return props.type === "analyse";
|
|
56
|
+
});
|
|
57
|
+
const speedLabel = vue.computed(() => {
|
|
58
|
+
if (speed.value === 1) {
|
|
59
|
+
return t("videoPlayer.multiples");
|
|
60
|
+
} else {
|
|
61
|
+
return speedList.find((item) => item.value === speed.value).label;
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
const isCanPlay = vue.computed(() => {
|
|
65
|
+
return videoState.value !== "NO_LOAD" || videoState.value !== "CAN_NOT_PLAY";
|
|
66
|
+
});
|
|
67
|
+
const currentDuration = vue.computed(() => {
|
|
68
|
+
const time = date.formatDuration(curTime.value, true);
|
|
69
|
+
if (!time) return "- -";
|
|
70
|
+
return `${time}"`;
|
|
71
|
+
});
|
|
72
|
+
const totalDuration = vue.computed(() => {
|
|
73
|
+
const time = date.formatDuration(totalTime.value, true);
|
|
74
|
+
if (!time) return "- -";
|
|
75
|
+
return `${time}"`;
|
|
76
|
+
});
|
|
77
|
+
async function initVideo() {
|
|
78
|
+
await vue.nextTick();
|
|
79
|
+
videoRef.value.addEventListener("canplay", (e) => {
|
|
80
|
+
loading.value = false;
|
|
81
|
+
if (!e.target?.videoWidth || !e.target?.videoHeight || !e.target?.webkitVideoDecodedByteCount) {
|
|
82
|
+
videoRef.value.pause();
|
|
83
|
+
videoState.value = "CAN_NOT_PLAY";
|
|
84
|
+
isCanNotPlayType.value = true;
|
|
85
|
+
console.error("canplay", e);
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
videoState.value = "IS_LOAD";
|
|
89
|
+
totalTime.value = Math.floor(videoRef.value.duration);
|
|
90
|
+
emits("canplay", e);
|
|
91
|
+
});
|
|
92
|
+
videoRef.value.addEventListener("play", () => {
|
|
93
|
+
videoRef.value.playbackRate = speed.value;
|
|
94
|
+
videoState.value = "PLAYING";
|
|
95
|
+
if (videoUrl.value && videoItem.value) {
|
|
96
|
+
emits("play-start", videoUrl.value, videoItem.value);
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
videoRef.value.addEventListener("pause", (e) => {
|
|
100
|
+
if (isCanNotPlay(e)) {
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
videoState.value = "PAUSE";
|
|
104
|
+
});
|
|
105
|
+
videoRef.value.addEventListener("ended", () => {
|
|
106
|
+
videoState.value = "PLAY_END";
|
|
107
|
+
if (playRules.value === 2) {
|
|
108
|
+
playNext();
|
|
109
|
+
} else if (playRules.value === 3) {
|
|
110
|
+
videoRef.value.load();
|
|
111
|
+
videoRef.value.play();
|
|
112
|
+
}
|
|
113
|
+
emits("play-ended");
|
|
114
|
+
});
|
|
115
|
+
videoRef.value.addEventListener(
|
|
116
|
+
"timeupdate",
|
|
117
|
+
(e) => {
|
|
118
|
+
if (isCanNotPlay(e)) {
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
videoState.value = "PLAYING";
|
|
122
|
+
if (!isDrop.value) {
|
|
123
|
+
const currentTime = videoRef.value.currentTime;
|
|
124
|
+
if (videoRef.value) {
|
|
125
|
+
curTime.value = Math.floor(currentTime);
|
|
126
|
+
} else {
|
|
127
|
+
setTimeout(() => {
|
|
128
|
+
if (videoRef.value) {
|
|
129
|
+
curTime.value = Math.floor(currentTime);
|
|
130
|
+
}
|
|
131
|
+
}, 1e3);
|
|
132
|
+
}
|
|
133
|
+
progress.value = curTime.value / totalTime.value * 100;
|
|
134
|
+
emits("timeupdate", e);
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
false
|
|
138
|
+
);
|
|
139
|
+
videoRef.value.addEventListener("error", (e) => {
|
|
140
|
+
loading.value = false;
|
|
141
|
+
videoState.value = "CAN_NOT_PLAY";
|
|
142
|
+
isCanNotPlayType.value = isCantPlayType(e);
|
|
143
|
+
console.error("error", e);
|
|
144
|
+
videoRef.value = null;
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
async function playVideo(filePath, item) {
|
|
148
|
+
const { isSupport } = is.isSupportH265();
|
|
149
|
+
if (item && item.fileCoding === "H.265" && !isSupport) {
|
|
150
|
+
videoState.value = "CAN_NOT_PLAY";
|
|
151
|
+
isCanNotPlayType.value = true;
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
if (videoState.value === "CAN_NOT_PLAY") {
|
|
155
|
+
videoState.value = "NO_LOAD";
|
|
156
|
+
await vue.nextTick();
|
|
157
|
+
initVideo();
|
|
158
|
+
}
|
|
159
|
+
if (item) {
|
|
160
|
+
if (item.id !== videoItem.value.id || !videoRef.value.src) {
|
|
161
|
+
loading.value = true;
|
|
162
|
+
videoItem.value = item;
|
|
163
|
+
videoUrl.value = filePath;
|
|
164
|
+
videoRef.value.src = filePath;
|
|
165
|
+
}
|
|
166
|
+
} else if (videoUrl.value === "") {
|
|
167
|
+
return false;
|
|
168
|
+
}
|
|
169
|
+
if (videoItem.value.playSeconds) {
|
|
170
|
+
jumpDuration(videoItem.value.playSeconds);
|
|
171
|
+
}
|
|
172
|
+
await vue.nextTick();
|
|
173
|
+
videoRef.value.play();
|
|
174
|
+
videoState.value = "PLAYING";
|
|
175
|
+
}
|
|
176
|
+
function pauseVideo() {
|
|
177
|
+
if (videoState.value === "CAN_NOT_PLAY") return;
|
|
178
|
+
videoRef.value && videoRef.value.pause();
|
|
179
|
+
videoState.value = "PAUSE";
|
|
180
|
+
}
|
|
181
|
+
function playPrevious() {
|
|
182
|
+
if (props.type === "default") {
|
|
183
|
+
const index = props.playList.findIndex(
|
|
184
|
+
(item) => item.id === videoItem.value.id
|
|
185
|
+
);
|
|
186
|
+
if (index > 0 && index !== props.playList.length) {
|
|
187
|
+
const item = props.playList[index - 1];
|
|
188
|
+
playVideo(item.filePath, item);
|
|
189
|
+
emits("play-previous");
|
|
190
|
+
} else {
|
|
191
|
+
elementPlus.ElMessage.warning(t("videoPlayer.currentIsTheFirstItem"));
|
|
192
|
+
}
|
|
193
|
+
} else if (isAnalyseType.value) {
|
|
194
|
+
if (!isCanPlay.value) return;
|
|
195
|
+
emits("play-previous");
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
function playNext() {
|
|
199
|
+
if (props.type === "default") {
|
|
200
|
+
const index = props.playList.findIndex(
|
|
201
|
+
(item) => item.id === videoItem.value.id
|
|
202
|
+
);
|
|
203
|
+
if (index !== props.playList.length - 1) {
|
|
204
|
+
const item = props.playList[index + 1];
|
|
205
|
+
playVideo(item.filePath, item);
|
|
206
|
+
emits("play-next");
|
|
207
|
+
} else {
|
|
208
|
+
elementPlus.ElMessage.warning(t("videoPlayer.currentIsTheLastItem"));
|
|
209
|
+
}
|
|
210
|
+
} else if (isAnalyseType.value) {
|
|
211
|
+
if (!isCanPlay.value) return;
|
|
212
|
+
emits("play-next");
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
function playRulesHandler(value) {
|
|
216
|
+
if (value === 3) {
|
|
217
|
+
playRules.value = 1;
|
|
218
|
+
} else {
|
|
219
|
+
playRules.value = value + 1;
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
function speedHandler(value) {
|
|
223
|
+
speed.value = value;
|
|
224
|
+
if (!videoRef.value) return;
|
|
225
|
+
videoRef.value.playbackRate = value;
|
|
226
|
+
}
|
|
227
|
+
function changeVolume() {
|
|
228
|
+
if (!videoRef.value) return;
|
|
229
|
+
videoRef.value.volume = volumeValue.value / 100;
|
|
230
|
+
}
|
|
231
|
+
function getNowWh() {
|
|
232
|
+
curTime.value = totalTime.value * (progress.value / 100);
|
|
233
|
+
videoRef.value.currentTime = curTime.value;
|
|
234
|
+
isDrop.value = false;
|
|
235
|
+
}
|
|
236
|
+
function setVideoCurrentTime(currentTime) {
|
|
237
|
+
if (!videoRef.value || typeof currentTime !== "number") return;
|
|
238
|
+
videoRef.value.currentTime = currentTime;
|
|
239
|
+
}
|
|
240
|
+
function getPercent(num, total) {
|
|
241
|
+
num = parseFloat(num);
|
|
242
|
+
total = parseFloat(total);
|
|
243
|
+
if (isNaN(num) || isNaN(total)) {
|
|
244
|
+
return 0;
|
|
245
|
+
}
|
|
246
|
+
return total <= 0 ? 0 : Math.round(num / total * 1e4) / 100;
|
|
247
|
+
}
|
|
248
|
+
function isCanNotPlay(e) {
|
|
249
|
+
if (videoState.value === "CAN_NOT_PLAY") {
|
|
250
|
+
return true;
|
|
251
|
+
}
|
|
252
|
+
if (e && e.target.error) {
|
|
253
|
+
const { code } = e.target.error;
|
|
254
|
+
return code === 4;
|
|
255
|
+
}
|
|
256
|
+
return false;
|
|
257
|
+
}
|
|
258
|
+
function isCantPlayType(e) {
|
|
259
|
+
if (e.target.error) {
|
|
260
|
+
const { code, message } = e.target.error;
|
|
261
|
+
return code === 4 && !message.includes("Format error") || message.includes("PIPELINE_ERROR_DECODE");
|
|
262
|
+
}
|
|
263
|
+
return false;
|
|
264
|
+
}
|
|
265
|
+
function jumpDuration(s) {
|
|
266
|
+
videoRef.value.currentTime = s;
|
|
267
|
+
}
|
|
268
|
+
function initFullScreenEvent() {
|
|
269
|
+
document.addEventListener("fullscreenchange", fullscreenchangeHandler);
|
|
270
|
+
}
|
|
271
|
+
function destroyFullScreenEvent() {
|
|
272
|
+
document.removeEventListener("fullscreenchange", fullscreenchangeHandler);
|
|
273
|
+
}
|
|
274
|
+
function fullscreenchangeHandler(e) {
|
|
275
|
+
if (document.fullscreenElement) ; else {
|
|
276
|
+
isFullScreen.value = false;
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
function onFullScreenHandler() {
|
|
280
|
+
if (isFullScreen.value) {
|
|
281
|
+
const el = document;
|
|
282
|
+
if (el.exitFullscreen) {
|
|
283
|
+
el.exitFullscreen();
|
|
284
|
+
}
|
|
285
|
+
} else {
|
|
286
|
+
const el = document.documentElement;
|
|
287
|
+
if (el.requestFullscreen) {
|
|
288
|
+
isFullScreen.value = true;
|
|
289
|
+
el.requestFullscreen();
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
function videoCutting() {
|
|
294
|
+
const canvas = document.createElement("canvas");
|
|
295
|
+
const img = document.getElementById("img");
|
|
296
|
+
const video = videoRef.value;
|
|
297
|
+
video.setAttribute("crossOrigin", "anonymous");
|
|
298
|
+
canvas.width = video.clientWidth;
|
|
299
|
+
canvas.height = video.clientHeight;
|
|
300
|
+
canvas.getContext("2d").drawImage(video, 0, 0, canvas.width, canvas.height);
|
|
301
|
+
const dataURL = canvas.toDataURL("image/png");
|
|
302
|
+
img.setAttribute("src", dataURL);
|
|
303
|
+
}
|
|
304
|
+
function openVLC() {
|
|
305
|
+
const url = `${props.vlcProtocol}:${videoUrl.value}`;
|
|
306
|
+
window.protocolCheck(url, () => {
|
|
307
|
+
hasVLC.value = false;
|
|
308
|
+
elementPlus.ElMessage.error(t("videoPlayer.notInstallVlcTips"));
|
|
309
|
+
});
|
|
310
|
+
}
|
|
311
|
+
function downloadVLC() {
|
|
312
|
+
if (!props.vlcAddress) {
|
|
313
|
+
elementPlus.ElMessage.warning(
|
|
314
|
+
t("videoPlayer.pleaseConfigureTheAddressForDownloadingVLC")
|
|
315
|
+
);
|
|
316
|
+
return;
|
|
317
|
+
}
|
|
318
|
+
const newOpenWindow = window.open("about:blank");
|
|
319
|
+
if (newOpenWindow) {
|
|
320
|
+
newOpenWindow.location = props.vlcAddress;
|
|
321
|
+
}
|
|
322
|
+
if (newOpenWindow) {
|
|
323
|
+
elementPlus.ElMessage.success(t("videoPlayer.operationSuccessful"));
|
|
324
|
+
} else {
|
|
325
|
+
index.AppConfirmDialog.confirm({
|
|
326
|
+
title: "\u8DF3\u8F6C\u63D0\u793A",
|
|
327
|
+
content: `<div><p>${t(
|
|
328
|
+
"videoPlayer.theCurrentBrowserBlocksTheOpeningOfNewWindows"
|
|
329
|
+
)}</p><p>${t(
|
|
330
|
+
"videoPlayer.pleaseGoToTheBrowserSettingsAndClickOnTheDownloadOrCopyLinkToOpenInTheBrowser"
|
|
331
|
+
)}</p></div>`,
|
|
332
|
+
submitText: t("videoPlayer.copyLink"),
|
|
333
|
+
onSubmit: async () => {
|
|
334
|
+
await handler.copyText(props.vlcAddress);
|
|
335
|
+
elementPlus.ElMessage.success(t("hy.copySuccessfully"));
|
|
336
|
+
}
|
|
337
|
+
});
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
function onDownloadHandler() {
|
|
341
|
+
if (props.downloadFn) {
|
|
342
|
+
props.downloadFn(videoItem.value, props.playList);
|
|
343
|
+
return;
|
|
344
|
+
}
|
|
345
|
+
if (videoPlayerConfig.value.downloadFn) {
|
|
346
|
+
videoPlayerConfig.value.downloadFn(videoItem.value, props.playList);
|
|
347
|
+
return;
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
playRulesHandler(props.playRules);
|
|
351
|
+
speedHandler(props.speed);
|
|
352
|
+
initVideo();
|
|
353
|
+
return {
|
|
354
|
+
speed,
|
|
355
|
+
playRules,
|
|
356
|
+
loading,
|
|
357
|
+
videoItem,
|
|
358
|
+
videoUrl,
|
|
359
|
+
currentDuration,
|
|
360
|
+
totalDuration,
|
|
361
|
+
progress,
|
|
362
|
+
isDrop,
|
|
363
|
+
isFullScreen,
|
|
364
|
+
volumeValue,
|
|
365
|
+
hasVLC,
|
|
366
|
+
isCanNotPlayType,
|
|
367
|
+
videoState,
|
|
368
|
+
speedLabel,
|
|
369
|
+
isCanPlay,
|
|
370
|
+
isAnalyseType,
|
|
371
|
+
// 配置
|
|
372
|
+
speedList,
|
|
373
|
+
playRulesList,
|
|
374
|
+
// 函数
|
|
375
|
+
playVideo,
|
|
376
|
+
pauseVideo,
|
|
377
|
+
playPrevious,
|
|
378
|
+
playNext,
|
|
379
|
+
playRulesHandler,
|
|
380
|
+
speedHandler,
|
|
381
|
+
changeVolume,
|
|
382
|
+
getNowWh,
|
|
383
|
+
setVideoCurrentTime,
|
|
384
|
+
getPercent,
|
|
385
|
+
initFullScreenEvent,
|
|
386
|
+
destroyFullScreenEvent,
|
|
387
|
+
onFullScreenHandler,
|
|
388
|
+
videoCutting,
|
|
389
|
+
openVLC,
|
|
390
|
+
downloadVLC,
|
|
391
|
+
onDownloadHandler
|
|
392
|
+
};
|
|
393
|
+
};
|
|
394
|
+
const useVideoResize = (hy) => {
|
|
395
|
+
const { props, videoWrapperRef, videoRef } = hy;
|
|
396
|
+
const wrapperHeight = vue.ref(0);
|
|
397
|
+
const isExpand = vue.ref(true);
|
|
398
|
+
const videoHeight = vue.computed(() => {
|
|
399
|
+
if (!props.showShrink) {
|
|
400
|
+
return;
|
|
401
|
+
}
|
|
402
|
+
return `${isExpand.value ? wrapperHeight.value ? wrapperHeight.value - 58 : 0 : 0}px`;
|
|
403
|
+
});
|
|
404
|
+
let resizeObs;
|
|
405
|
+
async function listenerVideoWrapper() {
|
|
406
|
+
await vue.nextTick();
|
|
407
|
+
resizeObs = new ResizeObserver((entries) => {
|
|
408
|
+
const item = entries[0];
|
|
409
|
+
wrapperHeight.value = item.target.clientHeight;
|
|
410
|
+
});
|
|
411
|
+
resizeObs.observe(videoWrapperRef.value);
|
|
412
|
+
}
|
|
413
|
+
function unlistenerVideoWrapper() {
|
|
414
|
+
resizeObs && resizeObs.disconnect();
|
|
415
|
+
}
|
|
416
|
+
function onSwitchShrink() {
|
|
417
|
+
isExpand.value = !isExpand.value;
|
|
418
|
+
}
|
|
419
|
+
return {
|
|
420
|
+
isExpand,
|
|
421
|
+
videoHeight,
|
|
422
|
+
onSwitchShrink,
|
|
423
|
+
listenerVideoWrapper,
|
|
424
|
+
unlistenerVideoWrapper
|
|
425
|
+
};
|
|
426
|
+
};
|
|
427
|
+
|
|
428
|
+
exports.useVideoPlayer = useVideoPlayer;
|
|
429
|
+
exports.useVideoResize = useVideoResize;
|
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
.video-player-content {
|
|
2
|
+
width: 100%;
|
|
3
|
+
border: 1px solid rgba(var(--hy-border));
|
|
4
|
+
background: #040814;
|
|
5
|
+
border-radius: 12px;
|
|
6
|
+
overflow: hidden;
|
|
7
|
+
display: flex;
|
|
8
|
+
flex-direction: column;
|
|
9
|
+
position: relative;
|
|
10
|
+
transition: all 0.3s linear;
|
|
11
|
+
video {
|
|
12
|
+
width: 100%;
|
|
13
|
+
transition: all 0.3s linear;
|
|
14
|
+
}
|
|
15
|
+
&.video-player-content-pick-up {
|
|
16
|
+
height: 60px !important;
|
|
17
|
+
}
|
|
18
|
+
// 全屏播放器样式
|
|
19
|
+
&.full-video-player-content {
|
|
20
|
+
height: 100% !important;
|
|
21
|
+
position: fixed;
|
|
22
|
+
left: 0;
|
|
23
|
+
top: 0;
|
|
24
|
+
z-index: 999;
|
|
25
|
+
transition: none;
|
|
26
|
+
video {
|
|
27
|
+
transition: none;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.operator-box {
|
|
31
|
+
height: 65px;
|
|
32
|
+
.center-operator {
|
|
33
|
+
.app-icon {
|
|
34
|
+
width: 34px;
|
|
35
|
+
height: 34px;
|
|
36
|
+
}
|
|
37
|
+
&.center-analyse {
|
|
38
|
+
.last-icon,
|
|
39
|
+
.next-icon {
|
|
40
|
+
width: 30px;
|
|
41
|
+
height: 30px;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.left-operator {
|
|
47
|
+
font-size: 16px;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.right-operator {
|
|
51
|
+
.speed-box {
|
|
52
|
+
height: 28px;
|
|
53
|
+
font-size: 14px;
|
|
54
|
+
}
|
|
55
|
+
.app-icon {
|
|
56
|
+
width: 28px;
|
|
57
|
+
height: 28px;
|
|
58
|
+
&.volume-icon {
|
|
59
|
+
width: 30px;
|
|
60
|
+
height: 30px;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.float-operator-item {
|
|
67
|
+
position: absolute;
|
|
68
|
+
right: 16px;
|
|
69
|
+
z-index: 100;
|
|
70
|
+
color: rgba(var(--hy-main));
|
|
71
|
+
|
|
72
|
+
.app-icon {
|
|
73
|
+
width: 28px;
|
|
74
|
+
height: 28px;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
&:not(.video-player-content-pick-up) {
|
|
79
|
+
height: 100%;
|
|
80
|
+
video {
|
|
81
|
+
height: 0;
|
|
82
|
+
flex-grow: 1;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.operator-box {
|
|
87
|
+
width: 100%;
|
|
88
|
+
height: 42px;
|
|
89
|
+
flex-shrink: 0;
|
|
90
|
+
display: flex;
|
|
91
|
+
justify-content: space-between;
|
|
92
|
+
align-items: center;
|
|
93
|
+
position: relative;
|
|
94
|
+
background: #040814;
|
|
95
|
+
color: rgba(var(--hy-main));
|
|
96
|
+
padding: 0 10px;
|
|
97
|
+
margin-top: 16px;
|
|
98
|
+
|
|
99
|
+
.progress-box {
|
|
100
|
+
width: 100%;
|
|
101
|
+
height: 14px;
|
|
102
|
+
position: absolute;
|
|
103
|
+
top: -14px;
|
|
104
|
+
left: 0;
|
|
105
|
+
display: flex;
|
|
106
|
+
align-items: center;
|
|
107
|
+
justify-content: center;
|
|
108
|
+
text-align: center;
|
|
109
|
+
|
|
110
|
+
input[type='range'] {
|
|
111
|
+
width: 100%;
|
|
112
|
+
height: 6px;
|
|
113
|
+
outline: none;
|
|
114
|
+
border-radius: 20px;
|
|
115
|
+
-webkit-appearance: none; /*清除系统默认样式*/
|
|
116
|
+
background-color: #eaf5f9;
|
|
117
|
+
position: relative;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
input[type='range']::-webkit-slider-thumb {
|
|
121
|
+
-webkit-appearance: none; /*清除系统默认样式*/
|
|
122
|
+
width: 14px;
|
|
123
|
+
height: 14px;
|
|
124
|
+
border-radius: 20px;
|
|
125
|
+
background: rgba(var(--hy-main));
|
|
126
|
+
box-shadow: 0px 0px 6px 3px rgba(var(--hy-theme));
|
|
127
|
+
cursor: pointer;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
input[type='range']::-ms-fill-lower {
|
|
131
|
+
-webkit-appearance: none;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
.left-operator {
|
|
136
|
+
font-size: 12px;
|
|
137
|
+
font-weight: bold;
|
|
138
|
+
color: rgba(var(--hy-auxiliary));
|
|
139
|
+
display: flex;
|
|
140
|
+
align-items: center;
|
|
141
|
+
column-gap: 4px;
|
|
142
|
+
white-space: nowrap;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.center-operator {
|
|
146
|
+
position: absolute;
|
|
147
|
+
left: 50%;
|
|
148
|
+
top: 50%;
|
|
149
|
+
transform: translate(-50%, -50%);
|
|
150
|
+
display: flex;
|
|
151
|
+
align-items: center;
|
|
152
|
+
column-gap: 10px;
|
|
153
|
+
& > div {
|
|
154
|
+
display: flex;
|
|
155
|
+
align-items: center;
|
|
156
|
+
justify-content: center;
|
|
157
|
+
cursor: pointer;
|
|
158
|
+
.app-icon {
|
|
159
|
+
width: 26px;
|
|
160
|
+
height: 26px;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
&.center-analyse {
|
|
164
|
+
.last-icon,
|
|
165
|
+
.next-icon {
|
|
166
|
+
width: 22px;
|
|
167
|
+
height: 22px;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
.right-operator {
|
|
173
|
+
display: flex;
|
|
174
|
+
align-items: center;
|
|
175
|
+
justify-content: flex-end;
|
|
176
|
+
column-gap: 10px;
|
|
177
|
+
position: relative;
|
|
178
|
+
color: rgba(var(--hy-main));
|
|
179
|
+
|
|
180
|
+
.speed-box {
|
|
181
|
+
min-width: 60px;
|
|
182
|
+
height: 24px;
|
|
183
|
+
font-size: 12px;
|
|
184
|
+
color: rgba(var(--hy-auxiliary));
|
|
185
|
+
display: flex;
|
|
186
|
+
align-items: center;
|
|
187
|
+
justify-content: center;
|
|
188
|
+
cursor: pointer;
|
|
189
|
+
user-select: none;
|
|
190
|
+
padding: 0 6px;
|
|
191
|
+
border: 1px solid rgba(var(--hy-border));
|
|
192
|
+
border-radius: 4px;
|
|
193
|
+
background-color: rgba(var(--hy-background-2));
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
.app-icon {
|
|
197
|
+
width: 18px;
|
|
198
|
+
height: 18px;
|
|
199
|
+
cursor: pointer;
|
|
200
|
+
&.volume-icon {
|
|
201
|
+
width: 20px;
|
|
202
|
+
height: 20px;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
.float-operator-item {
|
|
209
|
+
position: absolute;
|
|
210
|
+
top: 20px;
|
|
211
|
+
right: 10px;
|
|
212
|
+
z-index: 100;
|
|
213
|
+
color: rgba(var(--hy-main));
|
|
214
|
+
display: flex;
|
|
215
|
+
flex-direction: column;
|
|
216
|
+
row-gap: 10px;
|
|
217
|
+
|
|
218
|
+
.app-icon {
|
|
219
|
+
width: 24px;
|
|
220
|
+
height: 24px;
|
|
221
|
+
cursor: pointer;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
.right-center-operator {
|
|
226
|
+
top: 40%;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
.vlc-between-control {
|
|
230
|
+
width: 30px;
|
|
231
|
+
display: flex;
|
|
232
|
+
align-items: center;
|
|
233
|
+
justify-content: center;
|
|
234
|
+
position: absolute;
|
|
235
|
+
top: 0;
|
|
236
|
+
bottom: 0;
|
|
237
|
+
background: linear-gradient(
|
|
238
|
+
to bottom,
|
|
239
|
+
rgba(28, 51, 74, 0) 0%,
|
|
240
|
+
#1c334ac4 50%,
|
|
241
|
+
rgba(28, 51, 74, 0) 100%
|
|
242
|
+
);
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
.popover-volume-slider {
|
|
247
|
+
min-width: auto !important;
|
|
248
|
+
width: 40px !important;
|
|
249
|
+
padding: 16px 0;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
.popover-speed {
|
|
253
|
+
min-width: auto !important;
|
|
254
|
+
width: 62px !important;
|
|
255
|
+
padding: 0px !important;
|
|
256
|
+
.speed-list {
|
|
257
|
+
width: 100%;
|
|
258
|
+
color: rgba(var(--hy-auxiliary));
|
|
259
|
+
font-size: 12px;
|
|
260
|
+
li {
|
|
261
|
+
transition: 0.5s;
|
|
262
|
+
height: 26px;
|
|
263
|
+
line-height: 26px;
|
|
264
|
+
text-align: center;
|
|
265
|
+
&:after {
|
|
266
|
+
transition: 0s;
|
|
267
|
+
}
|
|
268
|
+
&:hover,
|
|
269
|
+
&.selectBox {
|
|
270
|
+
color: rgba(var(--hy-theme));
|
|
271
|
+
background: rgba(var(--hy-background-3));
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
}
|