当前位置: 首页 > news >正文

自己怎么做企业网站建设免费代理服务器ip地址

自己怎么做企业网站建设,免费代理服务器ip地址,万方网官网入口,企业宣传片模板直接套用萤石云视频接入 本示例可用于实际接入萤石云开放平台视频,同时支持音频输入和输出。 实际优化内容 1.动态获取token 2.切换各公司和车间时,自动重新初始化播放器 let EZUIKit null; // 第三方库引用 let EZUIKitPlayers []; // 播放器实例数组 le…

萤石云视频接入

本示例可用于实际接入萤石云开放平台视频,同时支持音频输入和输出。

实际优化内容

1.动态获取token

2.切换各公司和车间时,自动重新初始化播放器

let EZUIKit = null; // 第三方库引用
let EZUIKitPlayers = []; // 播放器实例数组
let gss = ''; // 全局保存当前选择的 gss 值
let accessToken = ''; // 存储动态获取的 accessTokenconst APP_KEY = '----------------'; // 替换为实际 appKey
const APP_SECRET = '-----------'; // 替换为实际 appSecret// 页面加载时引入 ezuikit.js 并初始化播放器
Page.onLoad = function () {System.import('/gemcoderAppResource?appuuid=11ce5afa919d4289bdb6e71912c172b0&path=/files/ezuikit.js&resourcesId=1280590&version=0').then(res => {EZUIKit = res.default;return fetchAccessToken(); // 先获取 token}).then(token => {accessToken = token;initPlayers(gss); // 使用当前 gss 初始化播放器}).catch(err => {console.error('初始化失败:', err);});
};// 下拉选择变化时更新 gss 并重新初始化播放器
Page.下拉选择OnChange = function () {gss = gmcom.gs.value;console.log('选中的 gss:', gss);if (EZUIKit && accessToken) {initPlayers(gss);} else {console.warn('EZUIKit 或 accessToken 尚未准备好');}
};// 获取 accessToken
function fetchAccessToken() {const url = 'https://open.ys7.com/api/lapp/token/get';
return new Promise((resolve, reject) => {fetch(url, {method: 'POST',headers: {'Content-Type': 'application/x-www-form-urlencoded'},body: new URLSearchParams({appKey: APP_KEY,appSecret: APP_SECRET})}).then(response => response.json()).then(data => {if (data.code === '200') {resolve(data.data.accessToken);} else {reject(new Error(`获取 token 失败: ${data.msg}`));}}).catch(error => {reject(error);});
});
}
// 根据 gss 获取摄像头配置(不再包含 accessToken)
function getPlayerConfigs(gss) {const commonUrls = ['ezopen://open.ys7.com/-----1.hd.live','ezopen://open.ys7.com/---/1.hd.live','ezopen://open.ys7.com/-----/1.hd.live','ezopen://open.ys7.com/-------/1.hd.live'];
let urls = [];switch (gss) {case '0102':urls = ['ezopen://open.ys7.com/-------/1.hd.live','ezopen://open.ys7.com/------/1.hd.live','ezopen://open.ys7.com/------/1.hd.live'];break;case '0103':urls = ['ezopen://open.ys7.com/--------1.hd.live','ezopen://open.ys7.com/-----/1.hd.live','ezopen://open.ys7.com/------/1.hd.live','ezopen://open.ys7.com/--------/1.hd.live'];break;case '0110':urls = ['ezopen://open.ys7.com/-------/1.hd.live','ezopen://open.ys7.com/--------/1.hd.live','ezopen://open.ys7.com/--------/1.hd.live','ezopen://open.ys7.com/---------/1.hd.live'];break;default:urls = [...commonUrls];
}const baseIds = ['yt-dtView-10374446859161','yt-dtView-10474436971042','yt-dtView-17744698706218','yt-dtView-10744075992380'
];return urls.map((url, index) => ({id: baseIds[index],url: url
}));
}//
 清理播放器资源
function clearPlayers() {if (EZUIKitPlayers.length > 0) {EZUIKitPlayers.forEach(player => {if (player.stop) player.stop();});EZUIKitPlayers = [];}
}// 初始化播放器
function initPlayers(gss) {clearPlayers();
const playerConfigs = getPlayerConfigs(gss);playerConfigs.forEach(config => {const player = new EZUIKit.EZUIKitPlayer({id: config.id,accessToken: accessToken, // 使用动态获取的 tokenurl: config.url,autoplay: false,audio: 0,handleSuccess: () => {// 成功回调},handleError: (e) => {if (typeof doEvent === 'function') {doEvent('onError', e);} else {console.error('doEvent 未定义:', e);}}});EZUIKitPlayers.push(player);
  });
}
// 播放按钮
Page.按钮OnClick = function () {EZUIKitPlayers.forEach(player => player.play());
};// 暂停按钮
Page.按钮11OnClick = function () {EZUIKitPlayers.forEach(player => player.stop());
};// 切换地址按钮
Page.按钮111OnClick = function () {const newUrls = ['ezopen://open.ys7.com/-----/1.live','ezopen://open.ys7.com/------/1.live','ezopen://open.ys7.com/-----/1.live','ezopen://open.ys7.com/------/1.live'
];EZUIKitPlayers.forEach((player, index) => {if (index < newUrls.length) {player.stop().then(() => {player.play({ url: newUrls[index], accessToken: accessToken });});}
});

}

http://www.dtcms.com/a/618207.html

相关文章:

  • 前端 css selector 的层叠 优先级与继承
  • 基于python二手房数据分析系统 可视化 Scrapy 爬虫 链家二手房数据 Django框架 基于用户的协同过滤推荐 二手房推荐系统 (源码)✅
  • Rust 内部可变性的访问器模式
  • ThinkPHP8学习篇(十二):模型关联(二)
  • 药品行业做网站windows wordpress
  • 【读代码】LightRAG轻量级知识图谱增强检索系统的架构与实现
  • arm架构设备使用FISCO BCOS上搭建多机区块链网络
  • 【Android】LRU 与 Android 缓存策略
  • 使用 Python 语言 从 0 到 1 搭建完整 Web UI自动化测试学习系列 26--数据驱动--参数化处理 Excel 文件 3
  • 第41节:第三阶段总结:打造一个AR家具摆放应用
  • 建设网站流程2022年最新新闻播报稿件
  • 网站地图的作用长沙网站开发设计
  • 【读代码】最新端侧TTS模型NeuTTS-Air
  • 做装修网站多少钱四川成都住建局官网
  • Microsoft 远程桌面app,支持挂机宝,云主机服务器
  • 基于MATLAB的粒子群优化(PSO)算法对25杆桁架结构进行优化设计
  • 智能驾驶:从感知到规控的自动驾驶系统全解析
  • 练习项目:基于 LangGraph 和 MCP 服务器的本地语音助手
  • 在 VMware 的 Ubuntu 22.04 虚拟机和 Windows 主机之间设置共享剪贴板
  • 淄博专业网站建设哪家专业公司装修设计工程
  • 金融网站的设计中和阗盛工程建设有限公司网站
  • 《JavaScript基础-Day.4》笔记总结
  • 关于C++中的预编译指令
  • 做网站的重要性深圳程序开发
  • 其他落地手册:facebook实现与音视频剖析
  • 建站方法移动课程播放网站建设多少钱
  • ZJUCTF2025(预赛+决赛)-我的writeup
  • 2025.11.16 AI快讯
  • Java分治算法题目练习(快速/归并排序)
  • Python 生信进阶:Biopython 库完全指南(序列处理 + 数据库交互)