You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
745 lines
31 KiB
745 lines
31 KiB
"use strict";
|
|
(self["webpackChunk"] = self["webpackChunk"] || []).push([[8048],{
|
|
|
|
/***/ 8048:
|
|
/*!*********************************************************!*\
|
|
!*** ./src/components/Video/Play/index.jsx + 1 modules ***!
|
|
\*********************************************************/
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
// EXPORTS
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
Z: function() { return /* binding */ Play; }
|
|
});
|
|
|
|
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/index.js
|
|
var _react_17_0_2_react = __webpack_require__(59301);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/message/index.js + 4 modules
|
|
var message = __webpack_require__(8591);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/dropdown/index.js + 1 modules
|
|
var dropdown = __webpack_require__(38854);
|
|
// EXTERNAL MODULE: ./node_modules/_flv.js@1.5.0@flv.js/src/flv.js + 38 modules
|
|
var flv = __webpack_require__(19551);
|
|
// EXTERNAL MODULE: ./node_modules/_hls.js@1.5.7@hls.js/dist/hls.mjs
|
|
var dist_hls = __webpack_require__(70169);
|
|
// EXTERNAL MODULE: ./src/utils/authority.ts
|
|
var authority = __webpack_require__(77883);
|
|
// EXTERNAL MODULE: ./node_modules/_react-copy-to-clipboard@5.0.2@react-copy-to-clipboard/lib/index.js
|
|
var lib = __webpack_require__(56102);
|
|
// EXTERNAL MODULE: ./src/utils/fullscreen.ts
|
|
var fullscreen = __webpack_require__(91676);
|
|
;// CONCATENATED MODULE: ./src/components/Video/Play/index.less?modules
|
|
// extracted by mini-css-extract-plugin
|
|
/* harmony default export */ var Playmodules = ({"watermark":"watermark___hNYlv","videovideo":"videovideo___ovOkV","animate__loop":"animate__loop___mvL6s","upDown":"upDown___SlgHv","container":"container___g1WYG","video-container":"video-container___XPkWR","video-controls":"video-controls___to0Zq","hide":"hide___NA3DV","video-progress":"video-progress___gqHsd","seek":"seek___iZHBm","seek-tooltip":"seek-tooltip___uWyXx","bottom-controls":"bottom-controls___uoIBm","left-controls":"left-controls___mBEx4","right-controls":"right-controls___e9L6r","rateOverlay":"rateOverlay___HHBWe","controlText":"controlText___M_BWR","volume-controls":"volume-controls___fa3mE","fullscreen-button":"fullscreen-button___ur0es","fullscreen-button1":"fullscreen-button1___rfaXm","pip-button":"pip-button___GFO8W","playback-animation":"playback-animation___ndURq","volume":"volume___OTmpP","hidden":"hidden___o7GkT"});
|
|
;// CONCATENATED MODULE: ./src/components/Video/Play/index.jsx
|
|
var __async = (__this, __arguments, generator) => {
|
|
return new Promise((resolve, reject) => {
|
|
var fulfilled = (value) => {
|
|
try {
|
|
step(generator.next(value));
|
|
} catch (e) {
|
|
reject(e);
|
|
}
|
|
};
|
|
var rejected = (value) => {
|
|
try {
|
|
step(generator.throw(value));
|
|
} catch (e) {
|
|
reject(e);
|
|
}
|
|
};
|
|
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
step((generator = generator.apply(__this, __arguments)).next());
|
|
});
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function formatTime(timeInSeconds) {
|
|
if (isNaN(timeInSeconds)) {
|
|
return {
|
|
minutes: "00",
|
|
seconds: "00"
|
|
};
|
|
}
|
|
const result = new Date(timeInSeconds * 1e3).toISOString().substr(11, 8);
|
|
return {
|
|
hour: result.substr(0, 2),
|
|
minutes: result.substr(3, 2),
|
|
seconds: result.substr(6, 2)
|
|
};
|
|
}
|
|
Object.defineProperty(HTMLMediaElement.prototype, "playing", {
|
|
get: function() {
|
|
return !!(this.currentTime > 0 && !this.paused && !this.ended && this.readyState > 2);
|
|
}
|
|
});
|
|
function compareNumbers(a, b) {
|
|
return a - b;
|
|
}
|
|
function getTotalEffectTime(pos) {
|
|
pos.sort(compareNumbers);
|
|
let sum = 0;
|
|
for (let i = 0; i < pos.length - 1; i++) {
|
|
let v = Math.abs(pos[i + 1] - pos[i]);
|
|
if (v < 21) {
|
|
sum += v;
|
|
}
|
|
}
|
|
return sum;
|
|
}
|
|
const regex = /(android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini)/i;
|
|
/* harmony default export */ var Play = ((0,_react_17_0_2_react.forwardRef)(
|
|
({
|
|
allow_skip,
|
|
src,
|
|
toLog,
|
|
videoId,
|
|
logWatchHistory,
|
|
courseId = null,
|
|
startTime,
|
|
handlePause = () => {
|
|
},
|
|
handlePlay = () => {
|
|
},
|
|
handlePlayEnded = () => {
|
|
},
|
|
autoPlay = false,
|
|
onPlayEnded = () => {
|
|
}
|
|
// videoSpeed = 1,
|
|
}, ref) => {
|
|
var _a;
|
|
src = src == null ? void 0 : src.replace("http://", "https://");
|
|
const suf = (_a = src == null ? void 0 : src.split(".")) == null ? void 0 : _a.pop();
|
|
const isFlv = suf === "flv";
|
|
const el = (0,_react_17_0_2_react.useRef)();
|
|
const watermarkRef = (0,_react_17_0_2_react.useRef)();
|
|
const warpEl = (0,_react_17_0_2_react.useRef)();
|
|
const pauseIcon = (0,_react_17_0_2_react.useRef)();
|
|
const playIcon = (0,_react_17_0_2_react.useRef)();
|
|
const seekEl = (0,_react_17_0_2_react.useRef)();
|
|
const progressBarEl = (0,_react_17_0_2_react.useRef)();
|
|
const durationEl = (0,_react_17_0_2_react.useRef)();
|
|
const timeElapsedEl = (0,_react_17_0_2_react.useRef)();
|
|
const seekTooltipEl = (0,_react_17_0_2_react.useRef)();
|
|
const noMuteVolEl = (0,_react_17_0_2_react.useRef)();
|
|
const highVolEl = (0,_react_17_0_2_react.useRef)();
|
|
const lowVolEl = (0,_react_17_0_2_react.useRef)();
|
|
const volumeEl = (0,_react_17_0_2_react.useRef)();
|
|
const deviceMatch = navigator.userAgent.toLowerCase().match(regex);
|
|
const device = deviceMatch ? deviceMatch[0] : "pc";
|
|
const firstOnPlayFlag = (0,_react_17_0_2_react.useRef)(false);
|
|
const user = (0,authority/* userInfo */.eY)();
|
|
let totalDuration = 0;
|
|
let sumTimePlayed = 0;
|
|
let lastUpdatedTime = 0;
|
|
let logId = null;
|
|
let initLog = false;
|
|
let timeTick = 20;
|
|
let logCount = 1;
|
|
let isLoging = false;
|
|
let isSeeking = false;
|
|
let pos = [];
|
|
(0,_react_17_0_2_react.useImperativeHandle)(ref, () => ({
|
|
getLastUpdatedTime: () => el.current.currentTime,
|
|
getDuration: () => el.current.duration
|
|
}));
|
|
message/* default */.ZP.config({
|
|
maxCount: 1,
|
|
getContainer: () => warpEl.current
|
|
});
|
|
const log = (0,_react_17_0_2_react.useCallback)(
|
|
(callback, isEnd = false) => {
|
|
let params = {
|
|
point: el.current.currentTime
|
|
};
|
|
if (logId) {
|
|
params["log_id"] = logId;
|
|
params["watch_duration"] = getTotalEffectTime(pos);
|
|
params["total_duration"] = sumTimePlayed;
|
|
} else {
|
|
if (courseId) {
|
|
params["video_id"] = parseInt(videoId, 10);
|
|
params["course_id"] = courseId;
|
|
} else {
|
|
params["video_id"] = videoId;
|
|
}
|
|
params["duration"] = totalDuration;
|
|
params["device"] = device;
|
|
}
|
|
if (isEnd) {
|
|
params["ed"] = "1";
|
|
}
|
|
function getLogId() {
|
|
return __async(this, null, function* () {
|
|
isLoging = true;
|
|
let id = yield logWatchHistory == null ? void 0 : logWatchHistory(params);
|
|
logId = id;
|
|
isLoging = false;
|
|
if (callback) {
|
|
callback();
|
|
}
|
|
});
|
|
}
|
|
getLogId();
|
|
},
|
|
[videoId, courseId]
|
|
);
|
|
(0,_react_17_0_2_react.useEffect)(() => {
|
|
if (el.current) {
|
|
pauseIcon.current.style.display = "none";
|
|
playIcon.current.style.display = "block";
|
|
}
|
|
message/* default */.ZP.destroy();
|
|
let player = null;
|
|
if (flv/* default */.Z.isSupported && isFlv && src && (src == null ? void 0 : src.indexOf(".m3u8")) < 0) {
|
|
player = flv/* default */.Z.createPlayer({
|
|
type: "flv",
|
|
volume: 0.8,
|
|
cors: true,
|
|
url: src,
|
|
muted: false
|
|
});
|
|
if (el.current) {
|
|
player.attachMediaElement(el.current);
|
|
player.load();
|
|
}
|
|
} else {
|
|
el.current.setAttribute("src", src);
|
|
}
|
|
updateVolumeIcon();
|
|
return () => {
|
|
if (player) {
|
|
player.unload();
|
|
player.pause();
|
|
player.destroy();
|
|
player = null;
|
|
}
|
|
};
|
|
}, [el, isFlv, src]);
|
|
function playIconStatus() {
|
|
if (el.current.paused) {
|
|
pauseIcon.current.style.display = "none";
|
|
playIcon.current.style.display = "block";
|
|
} else {
|
|
pauseIcon.current.style.display = "block";
|
|
playIcon.current.style.display = "none";
|
|
}
|
|
}
|
|
function updateVolumeIcon() {
|
|
noMuteVolEl.current.style.display = "none";
|
|
lowVolEl.current.style.display = "none";
|
|
highVolEl.current.style.display = "none";
|
|
if (el.current.muted || el.current.volume === 0) {
|
|
noMuteVolEl.current.style.display = "block";
|
|
} else if (el.current.volume > 0 && el.current.volume <= 0.5) {
|
|
lowVolEl.current.style.display = "block";
|
|
} else {
|
|
highVolEl.current.style.display = "block";
|
|
}
|
|
}
|
|
(0,_react_17_0_2_react.useEffect)(() => {
|
|
const playButton = document.getElementById("play");
|
|
const playbackIcons = document.querySelectorAll(".playback-icons use");
|
|
function onPlay() {
|
|
handlePlay();
|
|
if (startTime && !firstOnPlayFlag.current) {
|
|
el.current.currentTime = startTime;
|
|
}
|
|
firstOnPlayFlag.current = true;
|
|
pos.push(el.current.currentTime);
|
|
if (!initLog) {
|
|
initLog = true;
|
|
if (toLog) {
|
|
log();
|
|
}
|
|
}
|
|
}
|
|
function onEnded() {
|
|
return __async(this, null, function* () {
|
|
playIconStatus();
|
|
pos.push(el.current.currentTime);
|
|
if (toLog) {
|
|
log(() => {
|
|
logId = null;
|
|
lastUpdatedTime = 0;
|
|
initLog = false;
|
|
isLoging = false;
|
|
isSeeking = false;
|
|
pos = [];
|
|
sumTimePlayed = 0;
|
|
logCount = 1;
|
|
}, true);
|
|
}
|
|
onPlayEnded();
|
|
});
|
|
}
|
|
function updateProgress() {
|
|
seekEl.current.value = Math.round(el.current.currentTime);
|
|
progressBarEl.current.value = Math.round(el.current.currentTime);
|
|
}
|
|
function updateTimeElapsed() {
|
|
const time = formatTime(Math.round(el.current.currentTime));
|
|
timeElapsedEl.current.innerText = `${time.hour > 0 ? time.hour + ":" : ""}${time.minutes}:${time.seconds}`;
|
|
timeElapsedEl.current.setAttribute(
|
|
"datetime",
|
|
`${time.hour > 0 ? " " + time.hour + " " : ""}${time.minutes}m ${time.seconds}s`
|
|
);
|
|
}
|
|
function initializeVideo() {
|
|
const videoDuration = Math.round(el.current.duration);
|
|
seekEl.current.setAttribute("max", videoDuration);
|
|
progressBarEl.current.setAttribute("max", videoDuration);
|
|
const time = formatTime(videoDuration);
|
|
durationEl.current.innerText = `${time.hour > 0 ? time.hour + ":" : ""}${time.minutes}:${time.seconds}`;
|
|
durationEl.current.setAttribute(
|
|
"datetime",
|
|
`${time.hour > 0 ? " " + time.hour + " " : ""}${time.minutes}m ${time.seconds}s`
|
|
);
|
|
}
|
|
function onTimeupdate() {
|
|
try {
|
|
const videoDuration = Math.round(el.current.duration);
|
|
seekEl.current.setAttribute("max", videoDuration);
|
|
progressBarEl.current.setAttribute("max", videoDuration);
|
|
const time = formatTime(videoDuration);
|
|
durationEl.current.innerText = `${time.hour > 0 ? time.hour + ":" : ""}${time.minutes}:${time.seconds}`;
|
|
durationEl.current.setAttribute(
|
|
"datetime",
|
|
`${time.hour > 0 ? " " + time.hour + " " : ""}${time.minutes}m ${time.seconds}s`
|
|
);
|
|
updateProgress();
|
|
updateTimeElapsed();
|
|
const {
|
|
width,
|
|
height,
|
|
x,
|
|
y
|
|
} = watermarkRef.current.getBoundingClientRect();
|
|
if (x < 0 || y < 0 || !width) {
|
|
return;
|
|
}
|
|
if (!isSeeking) {
|
|
let newTime = el.current.currentTime;
|
|
let timeDiff = newTime - lastUpdatedTime;
|
|
if (Math.abs(timeDiff) < 10) {
|
|
sumTimePlayed += Math.abs(timeDiff);
|
|
lastUpdatedTime = newTime;
|
|
if (!isLoging) {
|
|
if (sumTimePlayed - logCount * timeTick >= 0) {
|
|
logCount++;
|
|
pos.push(lastUpdatedTime);
|
|
if (toLog) {
|
|
log();
|
|
}
|
|
}
|
|
}
|
|
} else {
|
|
lastUpdatedTime = newTime;
|
|
if (toLog) {
|
|
log();
|
|
}
|
|
}
|
|
}
|
|
} catch (error) {
|
|
console.log(error);
|
|
}
|
|
}
|
|
function onSeeking() {
|
|
isSeeking = true;
|
|
}
|
|
function onSeeked() {
|
|
if (el.current.playing) {
|
|
pos.push(el.current.currentTime, lastUpdatedTime);
|
|
}
|
|
lastUpdatedTime = el.current.currentTime;
|
|
isSeeking = false;
|
|
}
|
|
function onCanPlay() {
|
|
totalDuration = el.current.duration;
|
|
if (totalDuration <= 20) {
|
|
timeTick = totalDuration / 3;
|
|
}
|
|
el.current.addEventListener("play", onPlay);
|
|
}
|
|
function onFullscreenchange(e) {
|
|
e.preventDefault();
|
|
if ((0,fullscreen/* IsFull */.vp)()) {
|
|
el.current.style.width = "100%";
|
|
el.current.style.height = "100%";
|
|
} else {
|
|
el.current.style.cssText = "";
|
|
}
|
|
}
|
|
function onPause() {
|
|
handlePause();
|
|
}
|
|
function skipAhead(event) {
|
|
if (!allow_skip) {
|
|
message/* default */.ZP.warning("\u8BE5\u89C6\u9891\u7981\u6B62\u5FEB\u8FDB/\u540E\u9000\u64AD\u653E");
|
|
return;
|
|
}
|
|
const skipTo = event.target.dataset.seek ? event.target.dataset.seek : event.target.value;
|
|
el.current.currentTime = skipTo;
|
|
progressBarEl.current.value = skipTo;
|
|
seekEl.current.value = skipTo;
|
|
}
|
|
function updateSeekTooltip(event) {
|
|
const skipTo = Math.round(
|
|
event.offsetX / event.target.clientWidth * parseInt(event.target.getAttribute("max"), 10)
|
|
);
|
|
seekEl.current.setAttribute("data-seek", skipTo);
|
|
const t = formatTime(skipTo);
|
|
seekTooltipEl.current.textContent = `${t.hour > 0 ? t.hour + ":" : ""}${t.minutes}:${t.seconds}`;
|
|
const rect = el.current.getBoundingClientRect();
|
|
seekTooltipEl.current.style.left = `${event.pageX - rect.left}px`;
|
|
}
|
|
function handleKeyDown(e) {
|
|
switch (e.code) {
|
|
case "Space":
|
|
e.preventDefault();
|
|
togglePlay();
|
|
break;
|
|
case "ArrowRight":
|
|
e.preventDefault();
|
|
if (!allow_skip) {
|
|
message/* default */.ZP.warning("\u8BE5\u89C6\u9891\u7981\u6B62\u5FEB\u8FDB/\u540E\u9000\u64AD\u653E");
|
|
break;
|
|
}
|
|
if (el.current.currentTime >= el.current.duration) {
|
|
break;
|
|
}
|
|
el.current.currentTime = parseInt(el.current.currentTime) + 5;
|
|
updateProgress();
|
|
break;
|
|
case "ArrowLeft":
|
|
e.preventDefault();
|
|
if (!allow_skip) {
|
|
message/* default */.ZP.warning("\u8BE5\u89C6\u9891\u7981\u6B62\u5FEB\u8FDB/\u540E\u9000\u64AD\u653E");
|
|
break;
|
|
}
|
|
if (el.current.currentTime === 0) {
|
|
break;
|
|
}
|
|
el.current.currentTime = parseInt(el.current.currentTime) - 5;
|
|
updateProgress();
|
|
break;
|
|
case "ArrowUp":
|
|
e.preventDefault();
|
|
if (el.current.volume < 1) {
|
|
el.current.volume = (parseInt(el.current.volume * 10) + 1) / 10;
|
|
}
|
|
break;
|
|
case "ArrowDown":
|
|
e.preventDefault();
|
|
if (el.current.volume > 0) {
|
|
el.current.volume = (parseInt(el.current.volume * 10) - 1) / 10;
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
warpEl.current.addEventListener((0,fullscreen/* fullscreenChange */.gH)(), onFullscreenchange);
|
|
el.current.addEventListener("canplay", onCanPlay);
|
|
el.current.addEventListener("ended", onEnded);
|
|
el.current.addEventListener("seeking", onSeeking);
|
|
el.current.addEventListener("seeked", onSeeked);
|
|
el.current.addEventListener("loadedmetadata", initializeVideo);
|
|
seekEl.current.addEventListener("mousemove", updateSeekTooltip);
|
|
seekEl.current.addEventListener("input", skipAhead);
|
|
el.current.addEventListener("timeupdate", onTimeupdate);
|
|
el.current.addEventListener("pause", onPause);
|
|
el.current.addEventListener("volumechange", updateVolumeIcon);
|
|
document.addEventListener("keydown", handleKeyDown);
|
|
return () => {
|
|
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
|
|
(_a2 = el.current) == null ? void 0 : _a2.removeEventListener("canplay", onCanPlay);
|
|
(_b = el.current) == null ? void 0 : _b.removeEventListener("play", onPlay);
|
|
(_c = el.current) == null ? void 0 : _c.removeEventListener("ended", onEnded);
|
|
(_d = el.current) == null ? void 0 : _d.removeEventListener("seeking", onSeeking);
|
|
(_e = el.current) == null ? void 0 : _e.removeEventListener("seeked", onSeeked);
|
|
(_f = seekEl.current) == null ? void 0 : _f.removeEventListener("mousemove", updateSeekTooltip);
|
|
(_g = seekEl.current) == null ? void 0 : _g.removeEventListener("input", skipAhead);
|
|
(_h = el.current) == null ? void 0 : _h.removeEventListener("timeupdate", onTimeupdate);
|
|
(_i = el.current) == null ? void 0 : _i.removeEventListener("pause", onPause);
|
|
(_j = el.current) == null ? void 0 : _j.removeEventListener("loadedmetadata", initializeVideo);
|
|
(_k = el.current) == null ? void 0 : _k.removeEventListener("volumechange", updateVolumeIcon);
|
|
document.removeEventListener("keydown", handleKeyDown);
|
|
if ((_l = el.current) == null ? void 0 : _l.playing) {
|
|
pos.push(lastUpdatedTime, el.current.currentTime);
|
|
if (toLog) {
|
|
log();
|
|
}
|
|
}
|
|
};
|
|
}, [el, src]);
|
|
(0,_react_17_0_2_react.useEffect)(() => {
|
|
el.current.onended = () => {
|
|
handlePlayEnded(el);
|
|
};
|
|
el.current.oncontextmenu = () => {
|
|
return false;
|
|
};
|
|
if ((src == null ? void 0 : src.indexOf(".m3u8")) > -1) {
|
|
if (el.current.canPlayType("application/vnd.apple.mpegurl")) {
|
|
el.current.src = src;
|
|
} else if (dist_hls/* default.isSupported */.ZP.isSupported()) {
|
|
var hls = new dist_hls/* default */.ZP();
|
|
hls.loadSource(src);
|
|
hls.attachMedia(el.current);
|
|
}
|
|
}
|
|
}, [src]);
|
|
const [videoSpeed, setVideoSpeed] = (0,_react_17_0_2_react.useState)(1);
|
|
const togglePlay = () => {
|
|
if (el.current.paused || el.current.ended) {
|
|
el.current.play();
|
|
} else {
|
|
el.current.pause();
|
|
}
|
|
playIconStatus();
|
|
};
|
|
function toggleMute() {
|
|
el.current.muted = !el.current.muted;
|
|
if (el.current.muted) {
|
|
volumeEl.current.setAttribute("data-volume", volume.value);
|
|
volumeEl.current.value = 0;
|
|
} else {
|
|
volumeEl.current.value = volumeEl.current.dataset.volume;
|
|
}
|
|
}
|
|
return /* @__PURE__ */ _react_17_0_2_react.createElement("div", { style: { position: "relative" }, ref: warpEl }, /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
"div",
|
|
{
|
|
ref: watermarkRef,
|
|
className: `${Playmodules.watermark} animated_alternate animate__animated_10s animate__infinite animate__stepstart ${Playmodules.animate__loop}`
|
|
},
|
|
user ? user.login : " "
|
|
), /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: Playmodules["container"] }, /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: Playmodules["video-container"], id: "video-container" }, /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
"div",
|
|
{
|
|
className: Playmodules["playback-animation"],
|
|
id: "playback-animation"
|
|
},
|
|
/* @__PURE__ */ _react_17_0_2_react.createElement("svg", { className: Playmodules["playback-icons"] }, /* @__PURE__ */ _react_17_0_2_react.createElement("use", { className: "hidden", href: "#play-icon" }), /* @__PURE__ */ _react_17_0_2_react.createElement("use", { href: "#pause" }))
|
|
), /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
"video",
|
|
{
|
|
className: Playmodules["video"],
|
|
id: "video",
|
|
preload: "auto",
|
|
disablePictureInPicture: true,
|
|
ref: el,
|
|
autoPlay
|
|
}
|
|
), /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: `${Playmodules["video-controls"]} `, id: "video-controls" }, /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: Playmodules["bottom-controls"] }, /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: Playmodules["left-controls"] }, /* @__PURE__ */ _react_17_0_2_react.createElement("button", { "data-title": "\u64AD\u653E/\u6682\u505C", id: "play", onClick: togglePlay }, /* @__PURE__ */ _react_17_0_2_react.createElement("svg", { className: Playmodules["playback-icons"] }, /* @__PURE__ */ _react_17_0_2_react.createElement("use", { ref: playIcon, href: "#play-icon" }), /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
"use",
|
|
{
|
|
ref: pauseIcon,
|
|
style: { display: "none" },
|
|
href: "#pause"
|
|
}
|
|
))), /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: Playmodules["time"] }, /* @__PURE__ */ _react_17_0_2_react.createElement("time", { id: "time-elapsed", ref: timeElapsedEl }, "00:00"), /* @__PURE__ */ _react_17_0_2_react.createElement("span", null, " / "), /* @__PURE__ */ _react_17_0_2_react.createElement("time", { id: "duration", ref: durationEl }, "00:00"))), /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: Playmodules["right-controls"] }, allow_skip && /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
dropdown/* default */.Z,
|
|
{
|
|
placement: "top",
|
|
overlayClassName: Playmodules["rateOverlay"],
|
|
getPopupContainer: (trigger) => trigger.parentNode,
|
|
menu: {
|
|
items: [
|
|
{
|
|
key: "1",
|
|
label: /* @__PURE__ */ _react_17_0_2_react.createElement("span", { onClick: () => {
|
|
setVideoSpeed(1);
|
|
el.current.playbackRate = 1;
|
|
} }, "1.0x")
|
|
},
|
|
{
|
|
key: "2",
|
|
label: /* @__PURE__ */ _react_17_0_2_react.createElement("span", { onClick: () => {
|
|
setVideoSpeed(1.5);
|
|
el.current.playbackRate = 1.5;
|
|
} }, "1.5x")
|
|
},
|
|
{
|
|
key: "3",
|
|
label: /* @__PURE__ */ _react_17_0_2_react.createElement("span", { onClick: () => {
|
|
setVideoSpeed(2);
|
|
el.current.playbackRate = 2;
|
|
} }, "2.0x")
|
|
}
|
|
]
|
|
}
|
|
},
|
|
/* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: `${Playmodules["controlText"]} mr5` }, "\u500D\u901F")
|
|
), /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
lib.CopyToClipboard,
|
|
{
|
|
text: src,
|
|
onCopy: () => message/* default */.ZP.success("\u590D\u5236\u6210\u529F")
|
|
},
|
|
/* @__PURE__ */ _react_17_0_2_react.createElement("button", { "data-title": "\u590D\u5236\u94FE\u63A5" }, /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
"i",
|
|
{
|
|
className: `icon-lianjie2 iconfont`,
|
|
style: { fontSize: "12px", color: "white" }
|
|
}
|
|
))
|
|
), /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: Playmodules["volume-controls"] }, /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
"button",
|
|
{
|
|
"data-title": "\u5F00\u542F/\u5173\u95ED\u58F0\u97F3",
|
|
className: Playmodules["volume-button"],
|
|
id: "volume-button",
|
|
onClick: toggleMute
|
|
},
|
|
/* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
"i",
|
|
{
|
|
ref: noMuteVolEl,
|
|
className: `icon-a-bianzu8 iconfont`,
|
|
style: { fontSize: "14px", color: "white" }
|
|
}
|
|
),
|
|
/* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
"i",
|
|
{
|
|
ref: lowVolEl,
|
|
className: `icon-shengyinkaibeifen iconfont`,
|
|
style: { fontSize: "14px", color: "white" }
|
|
}
|
|
),
|
|
/* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
"i",
|
|
{
|
|
ref: highVolEl,
|
|
className: `icon-shengyinkai iconfont`,
|
|
style: { fontSize: "14px", color: "white" }
|
|
}
|
|
)
|
|
), /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
"input",
|
|
{
|
|
className: Playmodules["volume"],
|
|
id: "volume",
|
|
value: "1",
|
|
"data-mute": "0.5",
|
|
type: "range",
|
|
max: "1",
|
|
min: "0",
|
|
step: "0.01",
|
|
ref: volumeEl,
|
|
style: { display: "none" },
|
|
onClick: updateVolumeIcon
|
|
}
|
|
)), /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
"button",
|
|
{
|
|
"data-title": "\u5168\u5C4F/\u9000\u51FA\u5168\u5C4F",
|
|
className: Playmodules["fullscreen-button"],
|
|
onClick: () => {
|
|
if ((0,fullscreen/* IsFull */.vp)()) {
|
|
(0,fullscreen/* exitFull */.BU)();
|
|
} else {
|
|
(0,fullscreen/* requestFullScreen */.Dj)(warpEl.current);
|
|
}
|
|
}
|
|
},
|
|
/* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
"i",
|
|
{
|
|
className: `icon-fangda1 iconfont`,
|
|
style: { fontSize: "12px", color: "white" }
|
|
}
|
|
)
|
|
))), /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: Playmodules["video-progress"] }, /* @__PURE__ */ _react_17_0_2_react.createElement("progress", { ref: progressBarEl, value: "0", min: "0" }), /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
"input",
|
|
{
|
|
className: Playmodules.seek,
|
|
ref: seekEl,
|
|
value: "0",
|
|
min: "0",
|
|
type: "range",
|
|
step: "1"
|
|
}
|
|
), /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
"div",
|
|
{
|
|
className: Playmodules["seek-tooltip"],
|
|
ref: seekTooltipEl,
|
|
id: "seek-tooltip"
|
|
},
|
|
"00:00"
|
|
))))), /* @__PURE__ */ _react_17_0_2_react.createElement("svg", { style: { display: "none" } }, /* @__PURE__ */ _react_17_0_2_react.createElement("defs", null, /* @__PURE__ */ _react_17_0_2_react.createElement("symbol", { id: "pause", viewBox: "0 0 24 24" }, /* @__PURE__ */ _react_17_0_2_react.createElement("path", { d: "M14.016 5.016h3.984v13.969h-3.984v-13.969zM6 18.984v-13.969h3.984v13.969h-3.984z" })), /* @__PURE__ */ _react_17_0_2_react.createElement("symbol", { id: "play-icon", viewBox: "0 0 24 24" }, /* @__PURE__ */ _react_17_0_2_react.createElement("path", { d: "M8.016 5.016l10.969 6.984-10.969 6.984v-13.969z" })), /* @__PURE__ */ _react_17_0_2_react.createElement("symbol", { id: "volume-high", viewBox: "0 0 24 24" }, /* @__PURE__ */ _react_17_0_2_react.createElement("path", { d: "M14.016 3.234q3.047 0.656 5.016 3.117t1.969 5.648-1.969 5.648-5.016 3.117v-2.063q2.203-0.656 3.586-2.484t1.383-4.219-1.383-4.219-3.586-2.484v-2.063zM16.5 12q0 2.813-2.484 4.031v-8.063q1.031 0.516 1.758 1.688t0.727 2.344zM3 9h3.984l5.016-5.016v16.031l-5.016-5.016h-3.984v-6z" })), /* @__PURE__ */ _react_17_0_2_react.createElement("symbol", { id: "volume-low", viewBox: "0 0 24 24" }, /* @__PURE__ */ _react_17_0_2_react.createElement("path", { d: "M5.016 9h3.984l5.016-5.016v16.031l-5.016-5.016h-3.984v-6zM18.516 12q0 2.766-2.531 4.031v-8.063q1.031 0.516 1.781 1.711t0.75 2.32z" })), /* @__PURE__ */ _react_17_0_2_react.createElement("symbol", { id: "volume-mute", viewBox: "0 0 24 24" }, /* @__PURE__ */ _react_17_0_2_react.createElement("path", { d: "M12 3.984v4.219l-2.109-2.109zM4.266 3l16.734 16.734-1.266 1.266-2.063-2.063q-1.547 1.313-3.656 1.828v-2.063q1.172-0.328 2.25-1.172l-4.266-4.266v6.75l-5.016-5.016h-3.984v-6h4.734l-4.734-4.734zM18.984 12q0-2.391-1.383-4.219t-3.586-2.484v-2.063q3.047 0.656 5.016 3.117t1.969 5.648q0 2.203-1.031 4.172l-1.5-1.547q0.516-1.266 0.516-2.625zM16.5 12q0 0.422-0.047 0.609l-2.438-2.438v-2.203q1.031 0.516 1.758 1.688t0.727 2.344z" })), /* @__PURE__ */ _react_17_0_2_react.createElement("symbol", { id: "fullscreen", viewBox: "0 0 24 24" }, /* @__PURE__ */ _react_17_0_2_react.createElement("path", { d: "M14.016 5.016h4.969v4.969h-1.969v-3h-3v-1.969zM17.016 17.016v-3h1.969v4.969h-4.969v-1.969h3zM5.016 9.984v-4.969h4.969v1.969h-3v3h-1.969zM6.984 14.016v3h3v1.969h-4.969v-4.969h1.969z" })), /* @__PURE__ */ _react_17_0_2_react.createElement("symbol", { id: "fullscreen-exit", viewBox: "0 0 24 24" }, /* @__PURE__ */ _react_17_0_2_react.createElement("path", { d: "M15.984 8.016h3v1.969h-4.969v-4.969h1.969v3zM14.016 18.984v-4.969h4.969v1.969h-3v3h-1.969zM8.016 8.016v-3h1.969v4.969h-4.969v-1.969h3zM5.016 15.984v-1.969h4.969v4.969h-1.969v-3h-3z" })), /* @__PURE__ */ _react_17_0_2_react.createElement("symbol", { id: "pip", viewBox: "0 0 24 24" }, /* @__PURE__ */ _react_17_0_2_react.createElement("path", { d: "M21 19.031v-14.063h-18v14.063h18zM23.016 18.984q0 0.797-0.609 1.406t-1.406 0.609h-18q-0.797 0-1.406-0.609t-0.609-1.406v-14.016q0-0.797 0.609-1.383t1.406-0.586h18q0.797 0 1.406 0.586t0.609 1.383v14.016zM18.984 11.016v6h-7.969v-6h7.969z" })))));
|
|
}
|
|
));
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 91676:
|
|
/*!*********************************!*\
|
|
!*** ./src/utils/fullscreen.ts ***!
|
|
\*********************************/
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ BU: function() { return /* binding */ exitFull; },
|
|
/* harmony export */ Dj: function() { return /* binding */ requestFullScreen; },
|
|
/* harmony export */ gH: function() { return /* binding */ fullscreenChange; },
|
|
/* harmony export */ vp: function() { return /* binding */ IsFull; }
|
|
/* harmony export */ });
|
|
function requestFullScreen(element) {
|
|
try {
|
|
if (element.mozRequestFullScreen) {
|
|
element.mozRequestFullScreen();
|
|
} else if (element.webkitRequestFullScreen) {
|
|
element.webkitRequestFullScreen();
|
|
}
|
|
} catch (e) {
|
|
console.log(e, ":e");
|
|
}
|
|
}
|
|
function exitFull() {
|
|
if (window.top.document.webkitExitFullscreen) {
|
|
window.top.document.webkitExitFullscreen();
|
|
} else if (document.exitFullscreen) {
|
|
window.top.document.exitFullscreen();
|
|
} else if (document.msExitFullscreen) {
|
|
window.top.document.msExitFullscreen();
|
|
} else if (document.mozCancelFullScreen) {
|
|
window.top.document.mozCancelFullScreen();
|
|
}
|
|
}
|
|
const fullscreenChange = () => {
|
|
if (document.webkitExitFullscreen) {
|
|
return "webkitfullscreenchange";
|
|
} else if (document.exitFullscreen) {
|
|
return "fullscreenchange";
|
|
} else if (document.msExitFullscreen) {
|
|
return "msfullscreenchange";
|
|
} else if (document.mozCancelFullScreen) {
|
|
return "mozfullscreenchange";
|
|
}
|
|
};
|
|
function IsFull() {
|
|
var fullscreenElement = window.top.document.fullscreenElement || window.top.document.mozFullscreenElement || window.top.document.webkitFullscreenElement;
|
|
var fullscreenEnabled = document.fullscreenEnabled || document.mozFullscreenEnabled || document.webkitFullscreenEnabled;
|
|
console.log("fullscreenElement", fullscreenElement);
|
|
if (fullscreenElement == null) {
|
|
return false;
|
|
} else {
|
|
return true;
|
|
}
|
|
}
|
|
|
|
|
|
/***/ })
|
|
|
|
}]); |