zby-live-sdk
Version:
This is a live SDK for weclassroom.
75 lines (72 loc) • 2.42 kB
JavaScript
/*
* @Author: why
* @Date: 2019-08-08 19:33:44
* @LastEditors: Please set LastEditors
* @LastEditTime: 2021-05-24 16:47:40
* @Description:
*/
import {toolExt, liveExt} from '../config/config';
import callMethod from './call-method';
const EM = window.EM;
export default {
// 获取本地CPU内存占比
getCurCpuMemInfo: () => {
return callMethod('GetCurCpuMemInfo', null, 'getCurCpuMemInfo');
},
// ping给定的拉流url,调取一次ping30s后返回延迟及丢包信息抛出事件
startLossDelayPing: (args) => {
return callMethod('GetLossDelayInfo', args, 'startLossDelayPing');
},
// ping给定的拉流url,调取一次ping30s后返回延迟及丢包信息抛出事件
startSocialLossDelayPing: (args) => {
return callMethod('GetSocialLossDelayInfo', args, 'startSocialLossDelayPing');
},
// 获取上报公共字段信息
getCommonData() {
return callMethod('GetCommonData', {live_ext_ver: liveExt.version}, 'getCommonData');
},
// 打开一个路径选择窗口,返回选择的路径信息
openDialog() {
return callMethod('OpenDialog', null, 'openDialog');
},
// 跳转到给定url
jumpPage(url) {
return callMethod('JumpPage', {url}, 'jumpPage');
},
// 获取指定磁盘的总容量及剩余容量
getDiskSenseParameter(driver) {
return callMethod('GetDiskSenseParameter', {driver}, 'getDiskSenseParameter');
},
// 获取系统信息(系统名称,本地时间等)
getSystemInformation() {
return callMethod('GetSystemInformation', null, 'getSystemInformation');
},
// 获取学生端页面版本号
getPageVersion() {
return callMethod('GetPageVersion', null, 'getPageVersion');
},
stopLossDelayInfo() {
return callMethod('StopLossDelayInfo', null);
},
/**
* @function 保存图片至桌面
* @param { string } buf //base64编码图片数据
* @param { string } fileName //图片文件名(带格式后缀)
* @return: Promise
*/
saveImgToDesktop(buf, fileName) {
return callMethod('SaveImgToDesktop', {buf, fileName});
},
// 初始化
init(){
// 加载扩展
if (EM) {
// return new Promise(resolve => {
EM.Load(toolExt.name, toolExt.version, false, ()=>{
// resolve();
console.log('loadExt :zby_toolExt ......');
});
// });
}
}
};