|
@@ -758,6 +758,12 @@ class MarkerObj {
|
|
|
clearTimeout(this.timer);
|
|
|
this.timer = null;
|
|
|
}
|
|
|
+
|
|
|
+ if (this.limitTimer) {
|
|
|
+ clearInterval(this.limitTimer);
|
|
|
+ this.limitTimer = null;
|
|
|
+ }
|
|
|
+
|
|
|
if (this.imageOnOff.includes(this.type)) {// 클릭 이미지가 있는 경우
|
|
|
this.setImage('1');
|
|
|
}
|
|
@@ -799,24 +805,61 @@ class MarkerObj {
|
|
|
_MarkerHandle.selectedMarker = null;
|
|
|
}
|
|
|
|
|
|
- videoEvent() {
|
|
|
- let video = createVideoJs(this.ID, this.URL);
|
|
|
+ showLimitTime() {
|
|
|
+ const timer = $('.timer');
|
|
|
+ if (!this.video) {
|
|
|
+ timer.text('-');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ timer.text(30);
|
|
|
+
|
|
|
+ if (this.limitTimer) {
|
|
|
+ clearInterval(this.limitTimer)
|
|
|
+ this.limitTimer = null;
|
|
|
+ }
|
|
|
+ let cnt = 30;
|
|
|
+ this.limitTimer = setInterval(()=>{
|
|
|
+ if(cnt === 0) {
|
|
|
+ clearInterval(this.limitTimer);
|
|
|
+ this.limitTimer = null;
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ $('.timer').text(--cnt);
|
|
|
+ }, 1000)
|
|
|
+ }
|
|
|
+
|
|
|
+ playTimer() {
|
|
|
+ if (this.timer) {
|
|
|
+ clearTimeout(this.timer);
|
|
|
+ this.timer = null;
|
|
|
+ }
|
|
|
|
|
|
this.timer = setTimeout(()=>{
|
|
|
- if (video) {
|
|
|
- video.pause();
|
|
|
+ if (this.video) {
|
|
|
+ this.video.pause();
|
|
|
}
|
|
|
}, CCTV_DISPLAY_TIME);
|
|
|
+ }
|
|
|
+
|
|
|
+ videoEvent() {
|
|
|
+ this.video = createVideoJs(this.ID, this.URL, this);
|
|
|
+
|
|
|
+ this.playTimer();
|
|
|
+
|
|
|
+ this.showLimitTime();
|
|
|
|
|
|
$('.continue-play').on('click', ()=>{
|
|
|
- if (this.timer) {
|
|
|
- setTimeout(this.timer);
|
|
|
+ this.playTimer();
|
|
|
+ this.showLimitTime();
|
|
|
+
|
|
|
+ if (this.video) {
|
|
|
+ this.video.play();
|
|
|
}
|
|
|
- if (video) {
|
|
|
- video.play();
|
|
|
- this.timer = setTimeout(()=>{
|
|
|
- video.pause();
|
|
|
- }, CCTV_DISPLAY_TIME);
|
|
|
+ else {
|
|
|
+ $('#video-error').css('display', 'none');
|
|
|
+ $('.cctv-info-window .content > div:nth-child(1)').append($('<video id="video-'+this.ID+'" class="video-js" style="width: 100%; height: 100%;"></video>'))
|
|
|
+ this.videoEvent();
|
|
|
}
|
|
|
});
|
|
|
}
|
|
@@ -990,16 +1033,17 @@ class TbCCtvObj extends MarkerObj{
|
|
|
<div onclick="infoWindowEvent('${type}', '${ID}', 'close')">X</div>
|
|
|
</div>
|
|
|
<div class="content">
|
|
|
- <div>
|
|
|
+ <div style="display: flex; align-items: center; justify-content: center;">
|
|
|
<video id="video-${ID}" class="video-js" style="width: 100%; height: 100%;"></video>
|
|
|
+ <img id="video-error" style="display: none;" src="/images/icon/error.png" alt="스트리밍 오류 이미지">
|
|
|
</div>
|
|
|
<div>
|
|
|
- <div>※ CCTV영상은 30초간 제공됩니다.</div>
|
|
|
+ <div>남은시간 : <span class="timer">30</span> 초</div>
|
|
|
<div class="continue-play">계속재생</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>`;
|
|
|
-
|
|
|
+//<!-- <div>※ CCTV영상은 30초간 제공됩니다.</div>-->
|
|
|
return iwContent;
|
|
|
}
|
|
|
}
|
|
@@ -1224,7 +1268,7 @@ class IntersectionCameraObj extends MarkerObj{
|
|
|
<video id="video-${ID}" class="video-js" playsinline style="width: 100%; height: 100%;"></video>
|
|
|
</div>
|
|
|
<div>
|
|
|
- <div>※ CCTV영상은 30초간 제공됩니다.</div>
|
|
|
+ <div>남은시간 : <span class="timer">30</span> 초</div>
|
|
|
<div class="continue-play">계속재생</div>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -1439,7 +1483,7 @@ function getKakaoPosition(yCoordinate, xCoordinate) {
|
|
|
/**
|
|
|
* videoJs 객체 생성
|
|
|
*/
|
|
|
-function createVideoJs(id, url) {
|
|
|
+function createVideoJs(id, url, obj) {
|
|
|
let video = videojs("video-" + id, {
|
|
|
sources: [
|
|
|
{
|
|
@@ -1455,18 +1499,15 @@ function createVideoJs(id, url) {
|
|
|
});
|
|
|
|
|
|
//에러발생 시 대체 이미지 생성
|
|
|
- video.on('error', ()=>{
|
|
|
- if (video.error().code === 4) {
|
|
|
- video.pause();
|
|
|
- video.dispose();
|
|
|
- const $errorBox = $('.content > div:nth-child(1)');
|
|
|
- $errorBox.append($('<img src="/images/icon/error.png" alt="스트리밍 오류 이미지">'));
|
|
|
- $errorBox.css({
|
|
|
- display : 'flex',
|
|
|
- alignItems : 'center',
|
|
|
- justifyContent : 'center',
|
|
|
- });
|
|
|
- video = null;
|
|
|
+ video.on('error', function(){
|
|
|
+ if (this.error().code === 4) {
|
|
|
+ this.pause();
|
|
|
+ this.dispose();
|
|
|
+ $('#video-error').css('display', 'block');
|
|
|
+ clearInterval(obj.limitTimer);
|
|
|
+ clearTimeout(obj.timer);
|
|
|
+ $('.timer').text('-');
|
|
|
+ obj.video = null;
|
|
|
}
|
|
|
});
|
|
|
|