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

Loading…
Cancel
Save