|
|
|
|
@ -91,9 +91,9 @@ if (false) {}
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ 84184:
|
|
|
|
|
/***/ 15887:
|
|
|
|
|
/*!************************************************************!*\
|
|
|
|
|
!*** ./src/pages/Equipment/Working/index.tsx + 12 modules ***!
|
|
|
|
|
!*** ./src/pages/Equipment/Working/index.tsx + 13 modules ***!
|
|
|
|
|
\************************************************************/
|
|
|
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
@ -382,6 +382,94 @@ var laboratory = __webpack_require__(32089);
|
|
|
|
|
var useCustomRequest = __webpack_require__(64011);
|
|
|
|
|
// EXTERNAL MODULE: ./src/utils/fetch.ts
|
|
|
|
|
var fetch = __webpack_require__(43391);
|
|
|
|
|
;// CONCATENATED MODULE: ./src/components/Video/MsePlayer/index.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* harmony default export */ var MsePlayer = (/*#__PURE__*/(0,_react_17_0_2_react.forwardRef)(function (_ref) {
|
|
|
|
|
var src = _ref.src;
|
|
|
|
|
var videoRef = (0,_react_17_0_2_react.useRef)();
|
|
|
|
|
var mseQueue = [];
|
|
|
|
|
var mseSourceBuffer;
|
|
|
|
|
var mseStreamingStarted = false;
|
|
|
|
|
function startPlay(videoEl, url) {
|
|
|
|
|
var mse = new MediaSource();
|
|
|
|
|
videoRef.current.src = window.URL.createObjectURL(mse);
|
|
|
|
|
mse.addEventListener('sourceopen', function () {
|
|
|
|
|
var ws = new WebSocket(url);
|
|
|
|
|
ws.binaryType = 'arraybuffer';
|
|
|
|
|
ws.onopen = function (event) {
|
|
|
|
|
console.log('Connect to ws');
|
|
|
|
|
};
|
|
|
|
|
ws.onmessage = function (event) {
|
|
|
|
|
var data = new Uint8Array(event.data);
|
|
|
|
|
if (data[0] === 9) {
|
|
|
|
|
var mimeCodec;
|
|
|
|
|
var decodedArr = data.slice(1);
|
|
|
|
|
if (window.TextDecoder) {
|
|
|
|
|
mimeCodec = new TextDecoder('utf-8').decode(decodedArr);
|
|
|
|
|
} else {
|
|
|
|
|
mimeCodec = Utf8ArrayToStr(decodedArr);
|
|
|
|
|
}
|
|
|
|
|
mseSourceBuffer = mse.addSourceBuffer('video/mp4; codecs="' + mimeCodec + '"');
|
|
|
|
|
mseSourceBuffer.mode = 'segments';
|
|
|
|
|
mseSourceBuffer.addEventListener('updateend', pushPacket);
|
|
|
|
|
} else {
|
|
|
|
|
readPacket(event.data);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}, false);
|
|
|
|
|
}
|
|
|
|
|
function pushPacket() {
|
|
|
|
|
var packet;
|
|
|
|
|
if (!mseSourceBuffer.updating) {
|
|
|
|
|
if (mseQueue.length > 0) {
|
|
|
|
|
packet = mseQueue.shift();
|
|
|
|
|
mseSourceBuffer.appendBuffer(packet);
|
|
|
|
|
} else {
|
|
|
|
|
mseStreamingStarted = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (videoRef.current.buffered.length > 0) {
|
|
|
|
|
if (typeof document.hidden !== 'undefined' && document.hidden) {
|
|
|
|
|
// no sound, browser paused video without sound in background
|
|
|
|
|
videoRef.current.currentTime = videoRef.current.buffered.end(videoRef.current.buffered.length - 1) - 0.5;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
function readPacket(packet) {
|
|
|
|
|
if (!mseStreamingStarted) {
|
|
|
|
|
mseSourceBuffer.appendBuffer(packet);
|
|
|
|
|
mseStreamingStarted = true;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
mseQueue.push(packet);
|
|
|
|
|
if (!mseSourceBuffer.updating) {
|
|
|
|
|
pushPacket();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
|
|
|
// fix stalled video in safari
|
|
|
|
|
videoRef.current.addEventListener('pause', function () {
|
|
|
|
|
if (videoRef.current.currentTime > videoRef.current.buffered.end(videoRef.current.buffered.length - 1)) {
|
|
|
|
|
videoRef.current.currentTime = videoRef.current.buffered.end(videoRef.current.buffered.length - 1) - 0.1;
|
|
|
|
|
videoRef.current.play();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
startPlay(videoRef.current, src);
|
|
|
|
|
}, []);
|
|
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
|
|
style: {
|
|
|
|
|
position: 'relative'
|
|
|
|
|
},
|
|
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("video", {
|
|
|
|
|
width: '100%',
|
|
|
|
|
controls: true,
|
|
|
|
|
ref: videoRef,
|
|
|
|
|
height: 500,
|
|
|
|
|
src: src
|
|
|
|
|
})
|
|
|
|
|
});
|
|
|
|
|
}));
|
|
|
|
|
;// CONCATENATED MODULE: ./src/pages/Equipment/Working/index.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -409,6 +497,7 @@ var fetch = __webpack_require__(43391);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var IndexPage = function IndexPage(_ref) {
|
|
|
|
|
@ -597,7 +686,7 @@ var IndexPage = function IndexPage(_ref) {
|
|
|
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
|
|
|
//推流转换
|
|
|
|
|
getlist();
|
|
|
|
|
setitems();
|
|
|
|
|
// setitems()
|
|
|
|
|
}, []);
|
|
|
|
|
function getlist() {
|
|
|
|
|
return _getlist.apply(this, arguments);
|
|
|
|
|
@ -793,13 +882,8 @@ var IndexPage = function IndexPage(_ref) {
|
|
|
|
|
style: {
|
|
|
|
|
display: 'flex'
|
|
|
|
|
},
|
|
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("video", {
|
|
|
|
|
id: "1",
|
|
|
|
|
muted: true,
|
|
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("source", {
|
|
|
|
|
src: "http://192.168.1.22:8083/stream/1/channel/\u6D4B\u8BD5\u5BA4/hls/live/index.m3u8",
|
|
|
|
|
type: "application/x-mpegURL"
|
|
|
|
|
})
|
|
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(MsePlayer, {
|
|
|
|
|
src: 'ws://192.168.1.22:8083/stream/4/channel/0/mse?uuid=4&channel=0'
|
|
|
|
|
})
|
|
|
|
|
})]
|
|
|
|
|
})
|