/** * EZUIKitPlayer for npm */ (function (global, factory) { "use strict"; if (typeof module === "object" && typeof module.exports === "object") { module.exports = global.document ? factory(global, true) : function (w) { if (!w.document) { throw new Error("EZUIPlayer requires a window with a document"); } return factory(w); }; } else { factory(global); } // Pass this if window is not defined yet })(typeof window !== "undefined" ? window : this, function (window, noGlobal) { // 加载js function addJs(filepath, callback) { var headerScript = document.getElementsByTagName('head')[0].getElementsByTagName("script"); var isReady = false; for(var i = 0 ;i' + ' ' + '' + ''; capturePictureDOM.onclick = function () { _this.capturePicture(); } controsDOM.appendChild(capturePictureDOM); } console.log("matchHeaderOpt().saveModule", matchHeaderOpt().saveModule) if (matchHeaderOpt().saveModule) { var startSaveDOM = document.createElement('span'); startSaveDOM.innerHTML = '' + ' ' + ' ' + ' ' + '' startSaveDOM.onclick = function () { _this.startSave(); document.getElementById('startSave').setAttribute('class', 'icon hide'); document.getElementById('stopSave').setAttribute('class', 'icon'); } controsDOM.appendChild(startSaveDOM); var stopSaveDOM = document.createElement('span'); stopSaveDOM.innerHTML = '' + ' ' + ' ' + ' ' + ' ' stopSaveDOM.onclick = function () { _this.stopSave(); document.getElementById('stopSave').setAttribute('class', 'icon hide'); document.getElementById('startSave').setAttribute('class', 'icon'); } controsDOM.appendChild(stopSaveDOM); } if (matchHeaderOpt().zoomModule) { var enableZoomDOM = document.createElement('span'); enableZoomDOM.innerHTML = '' + ' ' + ' ' + ' ' + ''; enableZoomDOM.onclick = function () { _this.enableZoom(); document.getElementById('enableZoom').setAttribute('class', 'icon hide'); document.getElementById('closeZoom').setAttribute('class', 'icon'); } controsDOM.appendChild(enableZoomDOM); var closeZoomDOM = document.createElement('span'); closeZoomDOM.innerHTML = '' + ' ' + ' ' + ' ' + '' closeZoomDOM.onclick = function () { _this.closeZoom(); document.getElementById('closeZoom').setAttribute('class', 'icon hide'); document.getElementById('enableZoom').setAttribute('class', 'icon'); } controsDOM.appendChild(closeZoomDOM); } } /** * 渲染footer */ /** 根据配置匹配底部渲染 */ function matchFooterOpt() { var result = { footerContainer: false, talkModule: false, broadcastModule: false, hdModule: false, fullScreenModule: false, } var template = _this.opt.template; switch (template) { case 'simple': if (params.footer && params.footer instanceof Array) { var footer = params.footer; result = { footerContainer: true, talkModule: footer.indexOf('talk') !== -1, broadcastModule: footer.indexOf('broadcast') !== -1, hdModule: footer.indexOf('hd') !== -1, fullScreenModule: footer.indexOf('fullScreen') !== -1, } } break; case 'standard': if (params.footer && params.footer instanceof Array) { var footer = params.footer; result = { footerContainer: true, talkModule: footer.indexOf('talk') !== -1, broadcastModule: footer.indexOf('broadcast') !== -1, hdModule: footer.indexOf('hd') !== -1, fullScreenModule: footer.indexOf('fullScreen') !== -1, } } break; case 'security': break; case 'voice': result = { footerContainer: true, talkModule: true, broadcastModule: true, hdModule: true, fullScreenModule: true, } break; } return result; } /** 根据配置匹配底部渲染 */ function matchHeaderOpt() { var result = { headerContainer: false, capturePictureModule: false, saveModule: false, zoomModule: false, } var template = _this.opt.template; switch (template) { case 'simple': if (params.header && params.header instanceof Array) { var header = params.header; result = { headerContainer: true, capturePictureModule: header.indexOf('capturePicture') !== -1, saveModule: header.indexOf('save') !== -1, zoomModule: header.indexOf('zoom') !== -1, } } break; case 'standard': break; case 'security': break; case 'voice': result = { headerContainer: true, capturePictureModule: true, saveModule: true, zoomModule: true, } break; } return result; } if (matchFooterOpt().footerContainer || _this.opt.plugin.indexOf('talk') !== -1) { var recoderCSS = _this.opt.filePath + '/npm/css/recoder.css'; var recoderJs = _this.opt.filePath + '/npm/js/recoder.js'; var recorderJs = _this.opt.filePath + '/recorder.js'; // addCss() addCss(recoderCSS, function () {}) addJs(recoderJs, function () { addJs(recorderJs, function () {}); }); // 对讲模块 if (_this.opt.plugin.indexOf('talk') !== -1 || matchFooterOpt().talkModule) { function apiSuccess(data) { console.log("data", data); if (data.code == 200) { var apiResult = data.data; if (apiResult) { // 临时将https转换为websocket var rtcTrunk = apiResult.rtcUrl; if (rtcTrunk.indexOf("ws") === -1) { rtcTrunk = rtcTrunk.replace("https", "wss").replace("rtcgw", "rtcgw-ws"); } _this.opt.rtcUrl = rtcTrunk; _this.opt.ttsUrl = "tts://" + apiResult.ttsUrl; var talk = "talk://" + _this.opt.deviceSerial + ":0:" + _this.opt.channelNo + ":cas.ys7.com:6500"; _this.opt.talkLink = _this.opt.ttsUrl + "/" + talk; _this.opt.stream = apiResult.stream; console.log("_this.opt", _this.opt) // 加载依赖 if (!_this.opt.isReliesReady) { var adapeterJS = _this.opt.filePath + '/npm/js/adapeter.js'; var janusJS = _this.opt.filePath + '/npm/js/janus.js'; var ttsJS = _this.opt.filePath + '/npm/js/tts.js'; console.log("加载jquery.js"); addJs(adapeterJS, function () { console.log("加载adapeter.js"); addJs(janusJS, function () { console.log("加载janus.js"); addJs(ttsJS, function () { console.log("加载tts.js"); // 文件加载完毕; _this.opt.isReliesReady = true; }) }) }) } // 创建DOM if (!document.getElementById("audioleft")) { var audioleft = document.createElement('div'); audioleft.style.display = 'none'; audioleft.id = 'audioleft'; document.body.appendChild(audioleft) } if (!document.getElementById("audioright")) { var audioright = document.createElement('div'); audioright.style.display = 'none'; audioright.id = 'audioright'; document.body.appendChild(audioright) } } } } function apiError(err) { if (params.handleError) { params.handleError(err); } } request( _this.opt.apiDomain, 'POST', { accessToken: _this.opt.accessToken, deviceSerial: _this.opt.deviceSerial, channelNo: _this.opt.channelNo }, '', apiSuccess, apiError ); } if (matchFooterOpt().footerContainer) { // 底部容器 var footerContainer = document.createElement('div'); footerContainer.setAttribute("class", 'audio-controls'); domElement.appendChild(footerContainer); if (matchFooterOpt().hdModule || matchFooterOpt().fullScreenModule) { // 底部右侧元素 var rightContros = document.createElement('div'); rightContros.setAttribute('class', 'contros'); footerContainer.appendChild(rightContros); if (matchFooterOpt().hdModule) { // 高清-标清切换 var hdDom = document.createElement('span'); hdDom.setAttribute('id', 'video-hd'); hdDom.innerHTML = _this.opt.url.indexOf('.hd') === -1 ? '标清' : '高清'; hdDom.onclick = function () { // 停止 _this.stop(); if (_this.opt.url.indexOf('.hd') === -1) { _this.opt.url = _this.opt.url.replace('.live', '.hd.live'); hdDom.innerHTML = _this.opt.url.indexOf('.hd') === -1 ? '标清' : '高清'; } else { _this.opt.url = _this.opt.url.replace('.hd.live', '.live') } iframe.src = "https://open.ys7.com/ezopen/h5/iframe?url=" + _this.opt.url.replace('.hd.live', '.live') + "&autoplay=1&audio=" + _this.opt.audio + "&accessToken=" + _this.opt.accessToken + "&templete=" + 0; } rightContros.appendChild(hdDom); } if (matchFooterOpt().fullScreenModule) { // 声音控制 var openSoundDOM = document.createElement('span'); openSoundDOM.setAttribute('class', 'hide'); openSoundDOM.setAttribute('id', 'ezuikit-open-sound'); openSoundDOM.setAttribute('title', '打开声音'); openSoundDOM.setAttribute('style', 'vertical-align: top;'); openSoundDOM.innerHTML = '' openSoundDOM.onclick = function () { _this.openSound(0); openSoundDOM.setAttribute('class', 'hide'); closeSoundDOM.setAttribute('class', ''); } // 声音控制 var closeSoundDOM = document.createElement('span'); openSoundDOM.setAttribute('id', 'ezuikit-close-sound'); closeSoundDOM.setAttribute('class', 'hide'); closeSoundDOM.setAttribute('title', '关闭声音'); closeSoundDOM.setAttribute('style', 'vertical-align: top;'); closeSoundDOM.innerHTML = '' closeSoundDOM.onclick = function () { _this.closeSound(0); openSoundDOM.setAttribute('class', ''); closeSoundDOM.setAttribute('class', 'hide'); } rightContros.appendChild(openSoundDOM); rightContros.appendChild(closeSoundDOM); } // 根据当前音频配置展示 if (_this.opt.audio == 1) { closeSoundDOM.setAttribute('class', ''); } else { openSoundDOM.setAttribute('class', ''); _this.closeSound(0); } if (matchFooterOpt().fullScreenModule) { // 全屏控制 var fullScreenDOM = document.createElement('span'); fullScreenDOM.setAttribute('title', '全屏'); fullScreenDOM.setAttribute('style', 'vertical-align: top;'); fullScreenDOM.innerHTML = ' ' fullScreenDOM.onclick = function () { _this.fullScreen(); } rightContros.appendChild(fullScreenDOM); } } if (matchFooterOpt().talkModule) { // 对讲 var startTalkDOM = document.createElement('div'); var stopTalkDOM = document.createElement('div'); startTalkDOM.setAttribute("class", "ptp-talk off"); startTalkDOM.innerHTML = '' + '' + ' ' + ' ' + ' ' + ' ' + ' ' + ' 开启对讲' startTalkDOM.onclick = function () { console.log("EZUIKit.state.countTimer", EZUIKit.state.countTimer) if (EZUIKit.state.countTimer) { window.layer.msg("语音设备正忙,请稍后重试") return false; } countTime('add', 0); console.log("开始对讲,关闭声音") _this.closeSound(0); console.log(_this.opt) _this.startTalk(); this.setAttribute("class", "ptp-talk off hide"); stopTalkDOM.setAttribute("class", "ptp-talk on"); } stopTalkDOM.setAttribute("class", "ptp-talk on hide"); stopTalkDOM.innerHTML = '' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + '关闭对讲' stopTalkDOM.onclick = function () { console.log(_this.opt) _this.stopTalk(); countTime('destory', 0); _this.openSound(0); this.setAttribute("class", "ptp-talk on hide"); startTalkDOM.setAttribute("class", "ptp-talk off"); } footerContainer.appendChild(startTalkDOM); footerContainer.appendChild(stopTalkDOM); } if (matchFooterOpt().broadcastModule) { var startBroadcastDOM = document.createElement('div'); var stopBroadcastDOM = document.createElement('div'); startBroadcastDOM.setAttribute("class", 'broadcast off'); stopBroadcastDOM.setAttribute("class", "broadcast on hide"); startBroadcastDOM.innerHTML = ' ' + ' ' + ' ' + ' ' + '' + '语音播报'; startBroadcastDOM.onclick = function () { this.setAttribute("class", "broadcast off hide"); stopBroadcastDOM.setAttribute("class", "broadcast on"); } stopBroadcastDOM.innerHTML = '
' + '
' + '
' + '
    ' + '
' + '
' + '
' + '
自定义语音
' + '
' + '
' + '' + ' ' + ' ' + ' ' + '' + '语音播报' // //自定义语音唤起 // document.getElementById("voice-custom").onclick = function(){ // console.log("显示自定义语音"); // } stopBroadcastDOM.onclick = function () { this.setAttribute("class", "broadcast on hide"); startBroadcastDOM.setAttribute("class", "broadcast off"); } footerContainer.appendChild(startBroadcastDOM); footerContainer.appendChild(stopBroadcastDOM); // 召唤自定义语言 document.getElementById("voice-custom").onclick = function () { console.log("显示自定义语音"); startSpeakDOM.setAttribute('class', 'speak off'); } // 获取语音列表 fetchVoiceList(0); function fetchVoiceList(page) { function apiSuccess(data) { console.log("data", data); if (data.code == 200) { randerVoliceList(data.data, 5); EZUIKit.state.page = data.page.page; // 如果用户语音列表为空 if (page == 0 && data.data.length == 0 && !EZUIKit.state.fetchDefaultList) {// 获取用户语音为空 EZUIKit.state.fetchDefaultList = true; fetchVoiceList(0); } } } function apiError(err) { console.log("err", err) } request( 'https://open.ys7.com/api/lapp/voice/query', 'POST', { accessToken: _this.opt.accessToken, pageStart: page, pageSize: EZUIKit.state.pageSize, default: EZUIKit.state.fetchDefaultList ? 'true' : 'false' }, '', apiSuccess, apiError ); } function randerVoliceList(data) { console.log("renderVoliceList", data) if (data && data.length > 0) { for (var i = 0; i < data.length; i++) { var voiceItem = document.createElement('li'); voiceItem.innerHTML = "
  • " + (data[i]["voiceName"].length > 10 ? (data[i]["voiceName"].substr(0, 10) + "...") : data[i]["voiceName"]) + "
  • "; document.getElementsByClassName('voice-list-ul')[0].append(voiceItem); // "
  • " + (data[i]["voiceName"].length > 10 ? (data[i]["voiceName"].substr(0, 10) + "...") : data[i]["voiceName"]) + "
  • "; // $("#voice-list ul").append("
  • " + (data[i]["voiceName"].length > 10 ? (data[i]["voiceName"].substr(0, 10) + "...") : data[i]["voiceName"]) + "
  • "); voiceItem.onclick = function (e) { console.log("点击元素", e.target, e.target.dataset.url); var voiceUrl = e.target.dataset.url; var time = e.target.dataset.time; playListOfVoice(voiceUrl, time); } } if (data.length === EZUIKit.state.pageSize) { document.getElementById('voice-list-end').innerHTML = "向下滚动加载更多"; } else { document.getElementById('voice-list-end').innerHTML = "没有更多数据了"; } } } function playListOfVoice(voiceUrl, time) { console.log("播放语音", voiceUrl, time); // decoder && decoder.closeSound(0); function apiSuccess(data) { console.log("data.data", data.data) if (data.code == 200) { // $("#startBroadcast").show(); // $("#stopBroadcast").hide(); countTime('sub', parseInt(time)); } else if (data.code == "10001") { window.layer.msg("未找到当前语音") } else { window.layer.msg(data.msg || '发送失败,请稍后再试') } // padding = false; } function apiError(err) { console.log("err", err) } request( 'https://open.ys7.com/api/lapp/voice/send', 'POST', { accessToken: _this.opt.accessToken, deviceSerial: _this.opt.deviceSerial, channelNo: _this.opt.channelNo, fileUrl: voiceUrl, }, '', apiSuccess, apiError ); } // 自定义语音 // 对讲 var startSpeakDOM = document.createElement('div'); var stopSpeakDOM = document.createElement('div'); startSpeakDOM.setAttribute('class', 'speak off hide'); stopSpeakDOM.setAttribute('class', 'speak on hide'); startSpeakDOM.setAttribute('id', 'startSpeak'); stopSpeakDOM.setAttribute('id', 'stopSpeak'); startSpeakDOM.innerHTML = '' + ' ' + ' ' + ' ' + '' + '按住说话'; stopSpeakDOM.innerHTML = '' + '' + ' ' + '' + '' + '松开发送'; footerContainer.appendChild(startSpeakDOM); footerContainer.appendChild(stopSpeakDOM); document.getElementById("voice-list").onscroll = function (e) { var sum = this.scrollHeight; console.log("sum", sum, this.scrollTop, document.getElementById("voice-list").clientHeight); if (sum <= this.scrollTop + this.clientHeight) { console.log("拖动到底,执行加载", EZUIKit.state.page); fetchVoiceList(++EZUIKit.state.page); } } // $("#voice-list").unbind("scroll").bind("scroll", function (e) { // // console.log("e",e,this.scrollHeight, $(this).scrollTop() + $(this).height()) // var sum = this.scrollHeight; // if (sum <= $(this).scrollTop() + $(this).height()) { // console.log("拖动到底,执行加载", page); // fetchVoiceList(++page); // } // loading = false; // }); // time-area var timeAreaDOM = document.createElement('div'); timeAreaDOM.setAttribute('class', 'time-area'); timeAreaDOM.setAttribute('id', 'time-area'); timeAreaDOM.innerHTML = '00:00'; footerContainer.appendChild(timeAreaDOM); // 按住说话 var recorder; document.getElementById('startSpeak').onmousedown = function () { if (EZUIKit.state.countTimer) { window.layer.msg("语音设备正忙,请稍后重试") return false; } console.log("按住说话"); startSpeakDOM.setAttribute('class', 'speak off hide'); stopSpeakDOM.setAttribute('class', 'speak on'); // console.log("startRecording",startRecording); // startRecording(); voiceInit(); countTime('add', 0); setTimeout(() => { EZUIKit.state.recodeTime = 0; startRecording(); }, 1000) if (EZUIKit.state.recodeTimer) { // 先清空计数器 clearInterval(EZUIKit.state.recodeTimer); } EZUIKit.state.recodeTimer = setInterval(function () { if (EZUIKit.state.recodeTime >= 59) { _this.stopTalk(); countTime('destory', 0); this.setAttribute("class", "ptp-talk on hide"); startTalkDOM.setAttribute("class", "ptp-talk off"); window.layer.msg("不超过1分钟") } else { EZUIKit.state.recodeTime = EZUIKit.state.recodeTime + 1; } }, 1000); /** 录音控制 */ var audio_context; function startUserMedia(stream) { var input = audio_context.createMediaStreamSource(stream); recorder = new window.Recorder(input); } function startRecording() { recorder && recorder.record(); } function stopRecording() { recorder && recorder.stop(); recorder.clear(); } function voiceInit() { console.log("run init") try { // webkit shim window.AudioContext = window.AudioContext || window.webkitAudioContext; navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia; window.URL = window.URL || window.webkitURL; audio_context = new AudioContext; console.log('Audio context set up.'); console.log('navigator.getUserMedia ' + (navigator.getUserMedia ? 'available.' : 'not present!')); } catch (e) { console.log("err", e) window.layer.msg('No web audio support in this browser!'); } navigator.getUserMedia({ audio: true }, startUserMedia, function (e) { console.log('No live audio input: ' + e); }); }; } // 松开发送 document.getElementById('stopSpeak').onmouseup = function () { console.log("松开发送") stopSpeakDOM.setAttribute('class', 'speak on hide'); stopSpeakFun() function stopSpeakFun() { countTime('destory', 0); if (EZUIKit.state.recodeTime < 1) { window.layer.msg("说话时间过短"); clearInterval(EZUIKit.state.recodeTimer); return false; } clearInterval(EZUIKit.state.recodeTimer); wavUpload(); } function wavUpload() { try { recorder && recorder.stop(); // createAudioDom(); recorder && recorder.exportWAV(function (wav_file) { console.log("wav_file", wav_file); if (wav_file.size < 1000) { window.layer.msg("录音失败,请重试"); // recodeTime = 0; EZUIKit.state.recodeTime = 0 return false; } // 测试 countTime('sub', EZUIKit.state.recodeTime + 2); // 延时 var formdata = new FormData(); // form 表单 {key:value} formdata.append("voiceFile", wav_file); // form input type="file" formdata.append("accessToken", _this.opt.accessToken); formdata.append("deviceSerial", _this.opt.deviceSerial); formdata.append("channelNo", _this.opt.channelNo); // padding = true; function apiSuccess(data) { console.log("data.data", data.data) if (data.code == 200) { // $("#startBroadcast").show(); // $("#stopBroadcast").hide(); countTime('sub', EZUIKit.state.recodeTime + 2); } else if (data.code == "10001") { window.layer.msg("未找到当前语音") } else { window.layer.msg(data.msg || '发送失败,请稍后再试') } // padding = false; } function apiError(err) { console.log("err", err) } request( 'https://open.ys7.com/api/lapp/voice/sendonce', 'POST', { voiceFile: wav_file, accessToken: _this.opt.accessToken, deviceSerial: _this.opt.deviceSerial, channelNo: _this.opt.channelNo, }, '', apiSuccess, apiError ); }); recorder && recorder.clear(); } catch (err) { console.log(err); } } } } /* 时间计数 */ function countTime(type, start = 0) { clearInterval(EZUIKit.state.countTimer); if (type === 'add') { var i = start; EZUIKit.state.countTimer = setInterval(function () { ++i; document.getElementById("time-area").innerHTML = formatSeconds(i); }, 1000); } else if (type === 'sub') { var i = start; EZUIKit.state.countTimer = setInterval(function () { if (i > 0) { i--; document.getElementById("time-area").innerHTML = formatSeconds(i); } else { clearInterval(EZUIKit.state.countTimer); EZUIKit.state.countTimer = undefined; console.log("倒计时结束,开启声音"); // decoder.openSound(0); } }, 1000); } else if (type === 'destory') { clearInterval(EZUIKit.state.countTimer); EZUIKit.state.countTimer = undefined; document.getElementById("time-area").innerHTML = '00:00'; } //将秒数转换为时分秒格式 function formatSeconds(value) { var theTime = parseInt(value);// 秒 var middle = 0;// 分 var hour = 0;// 小时 var secondV = '00'; var minV = '00'; var hourV = '00' if (theTime > 59) { middle = parseInt(theTime / 60); theTime = parseInt(theTime % 60); if (middle > 59) { hour = parseInt(middle / 60); middle = parseInt(middle % 60); } } secondV = parseInt(theTime) > 9 ? parseInt(theTime) : ('0' + parseInt(theTime)); minV = parseInt(middle) > 9 ? parseInt(middle) : ('0' + parseInt(middle)); hourV = (parseInt(hour) > 9 ? parseInt(hour) : ('0' + parseInt(hour))); if (hour > 0) { return hourV + ':' + minV + ':' + secondV; } else if (middle > 0) { return minV + ':' + secondV; } else { return '00:' + secondV; } } } /* 将秒数转换为时分秒格式 */ function formatSeconds(value) { var theTime = parseInt(value);// 秒 var middle = 0;// 分 var hour = 0;// 小时 var secondV = '00'; var minV = '00'; var hourV = '00' if (theTime > 59) { middle = parseInt(theTime / 60); theTime = parseInt(theTime % 60); if (middle > 59) { hour = parseInt(middle / 60); middle = parseInt(middle % 60); } } secondV = parseInt(theTime) > 9 ? parseInt(theTime) : ('0' + parseInt(theTime)); minV = parseInt(middle) > 9 ? parseInt(middle) : ('0' + parseInt(middle)); hourV = (parseInt(hour) > 9 ? parseInt(hour) : ('0' + parseInt(hour))); if (hour > 0) { return hourV + ':' + minV + ':' + secondV; } else if (middle > 0) { return minV + ':' + secondV; } else { return '00:' + secondV; } } } } // }) // }) // iframe 传递数据 window.addEventListener( "message", function (event) { console.log("EZUIKitPlayer收到反馈", event); var origin = event.origin; if (event.data.type) { switch (event.data.type) { case 'openSound': if (params.openSoundCallBack) { params.openSoundCallBack(event.data) } break; case 'closeSound': if (params.closeSoundCallBack) { params.closeSoundCallBack(event.data) } break; case 'capturePicture': if (params.capturePictureCallBack) { params.capturePictureCallBack(event.data) } break; case 'startSave': if (params.startSaveCallBack) { params.startSaveCallBack(event.data) } break; case 'stopSave': if (params.stopSaveCallBack) { params.stopSaveCallBack(event.data) } break; case 'fullScreen': if (params.fullScreenCallBack) { params.fullScreenCallBack(event.data) } break; case 'getOSDTime': if (params.getOSDTimeCallBack) { params.getOSDTimeCallBack(event.data) } break; case 'handleSuccess': if (params.handleSuccess) { params.handleSuccess(event.data) } break; case 'handleError': if (params.handleError) { params.handleError(event.data) } break; } } } ) } // 播放相关API EZUIKitPlayer.prototype.play = function () { var id = 'EZUIKitPlayer-' + this.opt.id; var player = document.getElementById(id).contentWindow; player.postMessage({action:"play",accessToken: this.opt.accessToken,url:this.opt.url}, domain + "/ezopen/h5/iframe") } EZUIKitPlayer.prototype.stop = function () { var id = 'EZUIKitPlayer-' + this.opt.id; var player = document.getElementById(id).contentWindow; player.postMessage("stop", domain + "/ezopen/h5/iframe") } EZUIKitPlayer.prototype.openSound = function () { var id = 'EZUIKitPlayer-' + this.opt.id; var player = document.getElementById(id).contentWindow; player.postMessage("openSound", domain + "/ezopen/h5/iframe"); } EZUIKitPlayer.prototype.closeSound = function () { var id = 'EZUIKitPlayer-' + this.opt.id; var player = document.getElementById(id).contentWindow; player.postMessage("closeSound", domain + "/ezopen/h5/iframe") } EZUIKitPlayer.prototype.startSave = function (fileName) { var id = 'EZUIKitPlayer-' + this.opt.id; var player = document.getElementById(id).contentWindow; player.postMessage({action: "startSave",fileName: fileName || 'default'}, domain + "/ezopen/h5/iframe") } EZUIKitPlayer.prototype.stopSave = function () { var id = 'EZUIKitPlayer-' + this.opt.id; var player = document.getElementById(id).contentWindow; player.postMessage("stopSave", domain + "/ezopen/h5/iframe") } EZUIKitPlayer.prototype.fullScreen = function () { var id = 'EZUIKitPlayer-' + this.opt.id; var player = document.getElementById(id).contentWindow; player.postMessage("fullScreen", domain + "/ezopen/h5/iframe") } EZUIKitPlayer.prototype.capturePicture = function (fileName) { var id = 'EZUIKitPlayer-' + this.opt.id; var player = document.getElementById(id).contentWindow; player.postMessage({action: "capturePicture",fileName: fileName || 'default'}, domain + "/ezopen/h5/iframe") } EZUIKitPlayer.prototype.enableZoom = function () { var id = 'EZUIKitPlayer-' + this.opt.id; var player = document.getElementById(id).contentWindow; player.postMessage("enableZoom", domain + "/ezopen/h5/iframe") } EZUIKitPlayer.prototype.closeZoom = function () { var id = 'EZUIKitPlayer-' + this.opt.id; var player = document.getElementById(id).contentWindow; player.postMessage("closeZoom", domain + "/ezopen/h5/iframe") } EZUIKitPlayer.prototype.getOSDTime = function () { var id = 'EZUIKitPlayer-' + this.opt.id; var player = document.getElementById(id).contentWindow; player.postMessage("getOSDTime", domain + "/ezopen/h5/iframe") } EZUIKitPlayer.prototype.startTalk = function () { console.log("执行开始对讲"); console.log(this.opt); EZUIKit.opt = this.opt; window.startTalk(); } EZUIKitPlayer.prototype.stopTalk = function () { console.log("执行结束对讲"); window.stopTalk(); } /** * 视频播放器-结束 */ EZUIKit.EZUIKitPlayer = EZUIKitPlayer; window.EZUIKit = EZUIKit; if (!noGlobal) { window.EZUIKit = EZUIKit; } return EZUIKit; })