Skip to content

feat: logger and events #312

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 23 commits into from
Apr 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 0 additions & 34 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,37 +1,3 @@
## v8.1.8(2025-03-19)

#### Feat

- 支持巡检模板

- 兼容音频采样率异常设备录制

#### Fixed

- 修复部分AR设备获取标签信息报错

## v8.1.7(2025-03-05)

#### Feat

- 电子放大模块重构,操作更丝滑~

- 移动端支持双指操作电子放大功能

## v8.1.6(2025-02-10)

#### Feat

- 初始化支持配置关闭结束录制的默认下载行为【downloadRecord: false】

- 支持初始化设置【stopSaveCallBack】回调事件,在结束录制后通过该回调获取下载地址及文件数据

#### Fixed

- 修复了token为空时本地缓存地址依然可以播放的问题

- 修复了一些小bug

## v8.1.5(2025-01-15)

#### Feat
Expand Down
779 changes: 681 additions & 98 deletions README.md

Large diffs are not rendered by default.

33 changes: 20 additions & 13 deletions demos/base-demo/ezuikit.js

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Binary file not shown.

Large diffs are not rendered by default.

Binary file not shown.

Large diffs are not rendered by default.

Binary file not shown.
331 changes: 190 additions & 141 deletions demos/base-demo/index.html
Original file line number Diff line number Diff line change
@@ -1,149 +1,198 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta
name="viewport"
content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"
/>
<title>Document</title>
<style>
#video-container {
width: 600px;
height: 400px;
background-color: #000;
}
</style>
<script src="./ezuikit.js"></script>
</head>
<head>
<meta charset="UTF-8" />
<meta
name="viewport"
content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"
/>
<title>Document</title>
<style>
#video-container {
width: 600px;
height: 400px;
background-color: #000;
}
</style>
<script src="./ezuikit.js"></script>
</head>

<body>
<div className="demo">
<h2>视频模式使用示例:</h2>
<div>
<div id="video-container" style="width: 600px"></div>
</div>
<div>
<button onClick="init()">init</button>
<button onClick="play()">play</button>
<button onClick="stop()">stop</button>
<button onClick="getOSDTime()">getOSDTime</button>
<button onClick="capturePicture()">capturePicture</button>
<button onClick="openSound()">openSound</button>
<button onClick="closeSound()">closeSound</button>
<button onClick="startSave()">startSave</button>
<button onClick="stopSave()">stopSave</button>
<button onClick="ezopenStartTalk()">开始对讲</button>
<button onClick="ezopenStopTalk()">结束对讲</button>
<button onClick="fullScreen()">全屏</button>
<button onClick="destroy()">销毁</button>
</div>
<p style="font-style: italic">
播放多个视频,可初始化多个实例,参考:/demos/base-demo/multi-demo
</p>
</div>
<script>
var player;
<body>
<div className="demo">
<h2>视频模式使用示例:</h2>
<div>
<div id="video-container" style="width: 600px"></div>
</div>
<div>
<button onClick="init()">init</button>
<button onClick="play()">play</button>
<button onClick="stop()">stop</button>
<button onClick="getOSDTime()">getOSDTime</button>
<button onClick="capturePicture()">capturePicture</button>
<button onClick="openSound()">openSound</button>
<button onClick="closeSound()">closeSound</button>
<button onClick="startSave()">startSave</button>
<button onClick="stopSave()">stopSave</button>
<button onClick="ezopenStartTalk()">开始对讲</button>
<button onClick="ezopenStopTalk()">结束对讲</button>
<button onClick="fullScreen()">全屏</button>
<button onClick="destroy()">销毁</button>
</div>
<p style="font-style: italic">
播放多个视频,可初始化多个实例,参考:/demos/base-demo/multi-demo
</p>
</div>
<script>
var player;

function init() {
if (player) {
destroy();
}
function init() {
if (player) {
destroy();
}

// fetch('https://open.ys7.com/jssdk/ezopen/demo/token')
// .then(response => response.json())
// .then(res => {
// var accessToken = res.data.accessToken;
player = new EZUIKit.EZUIKitPlayer({
id: "video-container", // 视频容器ID
accessToken:
"at.clbukes44vf7k52873p71dby1qz1o7be-7sn9vqrwnw-1psx5mr-hd9shlp",
url: "ezopen://open.ys7.com/BB9480953/1.hd.live",
template: "pcLive", // simple: 极简版; pcLive: 预览; pcRec: 回放; security: 安防版; voice: 语音版;
plugin: ["talk"], // 加载插件,talk-对讲
width: 600,
height: 400,
language: "en", // zh | en
// debugDownloadData: true,
handleError: (error) => {
console.error("handleError", error);
},
env: {
// https://open.ys7.com/help/1772?h=domain
// domain默认是 https://open.ys7.com, 如果是私有化部署或海外的环境,请配置对应的domain
// The default domain is https://open.ys7.com If it is a private deployment or overseas (outside of China) environment, please configure the corresponding domain
domain: "https://open.ys7.com",
},
// staticPath: "/ezuikit_static", // 如果想使用本地静态资源,请复制根目录下ezuikit_static 到当前目录下, 然后设置该值
});
// });
}
// fetch('https://open.ys7.com/jssdk/ezopen/demo/token')
// .then(response => response.json())
// .then(res => {
// var accessToken = res.data.accessToken;
player = new EZUIKit.EZUIKitPlayer({
id: "video-container", // 视频容器ID
accessToken:
"ra.2zhsfvhv5n36uqiu5skq9a458d9g28o0-361rtyke9p-1r80x45-iteypfxmq",
url: "ezopen://open.ys7.com/BC7799091/1.hd.live",
template: "pcLive", // simple: 极简版; pcLive: 预览; pcRec: 回放; security: 安防版; voice: 语音版;
plugin: ["talk"], // 加载插件,talk-对讲
width: 600,
height: 400,
language: "en", // zh | en
// debugDownloadData: true,
handleError: (error) => {
console.error("handleError", error);
},
env: {
// https://open.ys7.com/help/1772?h=domain
// domain默认是 https://open.ys7.com, 如果是私有化部署或海外的环境,请配置对应的domain
// The default domain is https://open.ys7.com If it is a private deployment or overseas (outside of China) environment, please configure the corresponding domain
domain: "https://open.ys7.com",
},
// 日志打印设置
loggerOptions: {
// player.setLoggerOptions(options)
level: "INFO", // INFO LOG WARN ERROR
name: "ezuikit",
showTime: true,
},
// 视频流的信息回调类型
/**
* 打开流信息回调,监听 streamInfoCB 事件
* 0 : 每次都回调
* 1 : 只回调一次
* 注意:会影响性能
* 默认值 1
*/
streamInfoCBType: 1,
staticPath: "/ezuikit_static", // 如果想使用本地静态资源,请复制根目录下ezuikit_static 到当前目录下, 然后设置该值
});

function fullScreen() {
var playPromise = player.fullScreen();
}
function play() {
var playPromise = player.play();
playPromise.then((data) => {
console.log("promise 获取 数据", data);
});
}
function stop() {
var stopPromise = player.stop();
stopPromise.then((data) => {
console.log("promise 获取 数据", data);
});
}
function getOSDTime() {
var getOSDTimePromise = player.getOSDTime();
getOSDTimePromise.then((data) => {
console.log("promise 获取 数据", data);
});
}
player.eventEmitter.on(
EZUIKit.EZUIKitPlayer.EVENTS.videoInfo,
(info) => {
console.log("videoinfo", info);
},
);

function capturePicture() {
var capturePicturePromise = player.capturePicture();
capturePicturePromise.then((data) => {
console.log("promise 获取 数据", data);
});
}
function openSound() {
var openSoundPromise = player.openSound();
openSoundPromise.then((data) => {
console.log("promise 获取 数据", data);
});
}
function closeSound() {
var closeSoundPromise = player.closeSound();
closeSoundPromise.then((data) => {
console.log("promise 获取 数据", data);
});
}
function startSave() {
var startSavePromise = player.startSave(`${new Date().getTime()}`);
startSavePromise.then((data) => {
console.log("promise 获取 数据", data);
});
}
function stopSave() {
var stopSavePromise = player.stopSave();
stopSavePromise.then((data) => {
console.log("promise 获取 数据", data);
});
}
function ezopenStartTalk() {
player.startTalk();
}
function ezopenStopTalk() {
player.stopTalk();
}
player.eventEmitter.on(
EZUIKit.EZUIKitPlayer.EVENTS.audioInfo,
(info) => {
console.log("audioInfo", info);
},
);

function destroy() {
if (player) {
player.destroy();
}
player = null;
}
</script>
</body>
// 首帧渲染成功
// first frame display
player.eventEmitter.on(
EZUIKit.EZUIKitPlayer.EVENTS.firstFrameDisplay,
() => {
console.log("firstFrameDisplay ");
},
);
player.eventEmitter.on(
EZUIKit.EZUIKitPlayer.EVENTS.streamInfoCB,
(info) => {
console.log("streamInfoCB ", info);
},
);
// });
}

function fullScreen() {
var playPromise = player.fullScreen();
}

function play() {
var playPromise = player.play();
playPromise.then((data) => {
console.log("promise 获取 数据", data);
});
}

function stop() {
var stopPromise = player.stop();
stopPromise.then((data) => {
console.log("promise 获取 数据", data);
});
}
function getOSDTime() {
var getOSDTimePromise = player.getOSDTime();
getOSDTimePromise.then((data) => {
console.log("promise 获取 数据", data);
});
}

function capturePicture() {
var capturePicturePromise = player.capturePicture();
capturePicturePromise.then((data) => {
console.log("promise 获取 数据", data);
});
}
function openSound() {
var openSoundPromise = player.openSound();
openSoundPromise.then((data) => {
console.log("promise 获取 数据", data);
});
}
function closeSound() {
var closeSoundPromise = player.closeSound();
closeSoundPromise.then((data) => {
console.log("promise 获取 数据", data);
});
}
function startSave() {
var startSavePromise = player.startSave(
`${new Date().getTime()}`,
);
startSavePromise.then((data) => {
console.log("promise 获取 数据", data);
});
}
function stopSave() {
var stopSavePromise = player.stopSave();
stopSavePromise.then((data) => {
console.log("promise 获取 数据", data);
});
}
function ezopenStartTalk() {
player.startTalk();
}
function ezopenStopTalk() {
player.stopTalk();
}

function destroy() {
if (player) {
player.destroy();
}
player = null;
}
</script>
</body>
</html>
Loading