Skip to content

Instantly share code, notes, and snippets.

@stella6767
Created August 9, 2022 06:33
Show Gist options
  • Save stella6767/459851b817237ac0ac65957e37525093 to your computer and use it in GitHub Desktop.
Save stella6767/459851b817237ac0ac65957e37525093 to your computer and use it in GitHub Desktop.
javascript 리터럴 오브젝트 활용
let rds = {
monUiCtl: [],
isRun: false,
ctlUIStart: function (idx, ch) {
console.log("ctlUIStart????", idx, ch);
this.monUiCtl[idx].value.changeLayout(
1,
ch - 1,
this.monUiCtl[idx].serial,
ch
);
},
ctlUIDispose: function (idx) {
this.monUiCtl[idx]?.value?.dispose();
this.monUiCtl[idx]?.value?.init();
},
uiAllStart: function () {
console.log("init!!!!");
this.ctlUIStart(0, 1);
// this.ctlUIStart(1, 2);
// this.ctlUIStart(2, 3);
},
uiAllDispose: function () {
console.log("id 값을 줘야 되나? ");
this.ctlUIDispose(0);
this.ctlUIDispose(1);
this.ctlUIDispose(2);
},
receive: function (monUiCtl) {
console.log("receive", monUiCtl);
this.monUiCtl = monUiCtl;
console.log("receive2", this.monUiCtl);
let _SITEINFO_ = {
text: this.monUiCtl[0].rtsp_url,
};
var Logger = WespJSSDK.Logger;
Logger.useDefaults();
var Wesp = WespJSSDK.Wesp;
/**
* SDK-COMMENT
* MonitorUIController is the entry point of Monitor
*/
var MonitorUIController = WespJSSDK.MonitorUIController;
/*
monUiCtl: RDS에 등록된 장비 정보 및 재생 변수
serial: RDS에 등록된 장비 시리얼
stream: 장비에서 볼 stream type // main or sub
*/
/*
contanier 생성
*/
for (var i = 0; i < this.monUiCtl.length; i++) {
_SITEINFO_.serial = this.monUiCtl[i].serial;
_SITEINFO_.stream = "main";
console.log("contanier 생성");
var viewId = "video-viewport" + (i + 1);
this.monUiCtl[i].value = new MonitorUIController(viewId, _SITEINFO_);
}
/*
contanier 초기화
*/
var maxChannel = [];
for (var i = 0; i < this.monUiCtl.length; i++) {
console.log("contanier 초기화1");
this.monUiCtl[i].value.init(function () {
console.log("contanier 초기화2");
maxChannel.push(this.monUiCtl[i].getMaxChannel());
});
}
this.isRun = true;
},
};
//rds.receive();
window.addEventListener("load", (event) => {
console.log("page is loaded", rds);
// rds.receive();
// rds.uiAllStart();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment