Browse Source

flv 播放

simplify_dependencies
巴林闲侠 2 years ago
parent
commit
4615e48481
  1. 106
      console/client/src/sections/console/containers/index.js

106
console/client/src/sections/console/containers/index.js

@ -561,7 +561,7 @@ function Index (props) {
let msg = JSON.parse(evt.data);
if (msg) {
console.log(msg);
// console.log(msg);
draw('xy', { ...msg, from: 'lidarLive' })
}
}
@ -572,41 +572,90 @@ function Index (props) {
console.log(res);
if (
res.success
// || 1
) {
setVideo(res.payload.data)
const container = document.getElementById('video-play');
console.log(`准备播放`);
// 播放方式 1
const jessibuca = new window.Jessibuca({
container: container,
videoBuffer: 0.2, // 缓存时长
isResize: false,
text: "",
loadingText: "加载中",
debug: true,
showBandwidth: false, // 显示网速
operateBtns: {
fullscreen: false,
screenshot: false,
play: false,
audio: false,
},
forceNoOffscreen: false,
controlAutoHide: true,
isNotMute: false,
});
jessibucas.current = jessibuca
jessibuca.play(
// `ws://221.230.55.27:8081/jessica/34020000001110000001/34020000001310000009.flv`
`${res.payload.data.ws_flv}`
);
// const jessibuca = new window.Jessibuca({
// container: container,
// videoBuffer: 0.2, // 缓存时长
// isResize: false,
// text: "",
// loadingText: "加载中",
// debug: true,
// showBandwidth: false, // 显示网速
// operateBtns: {
// fullscreen: false,
// screenshot: false,
// play: false,
// audio: false,
// },
// forceNoOffscreen: false,
// controlAutoHide: true,
// isNotMute: false,
// });
// jessibucas.current = jessibuca
// jessibuca.play(
// `${res.payload.data.ws_flv}`
// );
// 播放方式 2
const flv = flvjs.createPlayer({
type: 'flv',
url: `${res.payload.data.ws_flv}`,
isLive: true,
hasAudio: false,
hasVideo: true,
}, {
enableWorker: false,
enalleStashBuffer: true,
stashInitialSize: 128,
lazyLoadMaxDuration: 3 * 60,
seekType: 'range',
autoCleanupSourceBuffer: true,
cors: true,
});
flv.attachMediaElement(container);
flv.load();
flv.play();
flvPlayer.current = flv
}
})
// setTimeout(() => {
// const container = document.getElementById('video-play');
// console.log(`准备播放`);
// // 播放方式 1
// // const jessibuca = new window.Jessibuca({
// // container: container,
// // videoBuffer: 0.2, // 缓存时长
// // isResize: false,
// // text: "",
// // loadingText: "加载中",
// // debug: true,
// // showBandwidth: false, // 显示网速
// // operateBtns: {
// // fullscreen: false,
// // screenshot: false,
// // play: false,
// // audio: false,
// // },
// // forceNoOffscreen: false,
// // controlAutoHide: true,
// // isNotMute: false,
// // });
// // jessibucas.current = jessibuca
// // jessibuca.play(
// // // `ws://221.230.55.27:8081/jessica/34020000001110000001/34020000001310000009.flv`
// // `ws://192.168.1.128:8081/jessica/34020000001320000001/34020000001320000001.flv`
// // );
// // 播放方式 2
// const flv = flvjs.createPlayer({
// type: 'flv',
// // url: `${res.payload.data.ws_flv}`,
// url: `ws://221.230.55.27:8081/jessica/34020000001110000001/34020000001310000009.flv`,
// url: `http://192.168.1.128:8081/hdl/34020000001320000001/34020000001320000001.flv`,
// isLive: true,
// hasAudio: false,
// hasVideo: true,
@ -623,8 +672,7 @@ function Index (props) {
// flv.load();
// flv.play();
// flvPlayer.current = flv
}
})
// }, 500);
return () => {
if (dataLiveWs) {

Loading…
Cancel
Save