@twab/visualization 0.9.7 → 0.9.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,2639 @@
1
+ import VTooltip from 'v-tooltip';
2
+ import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
3
+ import { library } from '@fortawesome/fontawesome-svg-core';
4
+ import { faBackward, faStepBackward, faClock, faStepForward, faForward, faPlay, faStop, faBorderAll, faSlidersH, faCut, faHourglassStart, faHourglassEnd, faVideo, faInfoCircle, faTachometerAlt, faServer, faEye, faEyeSlash, faBan, faSync, faArrowTurnDown, faArrowCircleDown, faPause } from '@fortawesome/free-solid-svg-icons';
5
+ import VueMask from 'v-mask';
6
+ import VueLoading from 'vue-loading-twa';
7
+ import axios from 'axios';
8
+
9
+ function colorVariation (baseColor) {
10
+ const baseHSL = hexToHSL(baseColor);
11
+ baseHSL.l += 30;
12
+ return hslToHex(baseHSL)
13
+ }
14
+
15
+ function hexToHSL(hex) {
16
+ hex = hex.replace(/^#/, '');
17
+ const r = parseInt(hex.slice(0, 2), 16) / 255;
18
+ const g = parseInt(hex.slice(2, 4), 16) / 255;
19
+ const b = parseInt(hex.slice(4, 6), 16) / 255;
20
+
21
+ const max = Math.max(r, g, b);
22
+ const min = Math.min(r, g, b);
23
+ let h,
24
+ s,
25
+ l = (max + min) / 2;
26
+
27
+ if (max === min) {
28
+ h = s = 0; // achromatic
29
+ } else {
30
+ const d = max - min;
31
+ s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
32
+ switch (max) {
33
+ case r:
34
+ h = (g - b) / d + (g < b ? 6 : 0);
35
+ break
36
+ case g:
37
+ h = (b - r) / d + 2;
38
+ break
39
+ case b:
40
+ h = (r - g) / d + 4;
41
+ break
42
+ }
43
+ h /= 6;
44
+ }
45
+
46
+ h = Math.round(h * 360);
47
+ s = Math.round(s * 100);
48
+ l = Math.round(l * 100);
49
+
50
+ return { h, s, l }
51
+ }
52
+
53
+ function hslToHex(hsl) {
54
+ const h = hsl.h / 360;
55
+ const s = hsl.s / 100;
56
+ const l = hsl.l / 100;
57
+
58
+ if (s === 0) {
59
+ // Achromatic (gray) color
60
+ const gray = Math.round(l * 255);
61
+ return `#${gray.toString(16).repeat(3)}`
62
+ }
63
+
64
+ const q = l < 0.5 ? l * (1 + s) : l + s - l * s;
65
+ const p = 2 * l - q;
66
+
67
+ const r = Math.round(hueToRGB(p, q, h + 1 / 3) * 255);
68
+ const g = Math.round(hueToRGB(p, q, h) * 255);
69
+ const b = Math.round(hueToRGB(p, q, h - 1 / 3) * 255);
70
+
71
+ return `#${r.toString(16).padStart(2, '0')}${g
72
+ .toString(16)
73
+ .padStart(2, '0')}${b.toString(16).padStart(2, '0')}`
74
+ }
75
+
76
+ function hueToRGB(p, q, t) {
77
+ if (t < 0) t += 1;
78
+ if (t > 1) t -= 1;
79
+ if (t < 1 / 6) return p + (q - p) * 6 * t
80
+ if (t < 1 / 2) return q
81
+ if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6
82
+ return p
83
+ }
84
+
85
+ function registerIcons () {
86
+ library.add(faBackward);
87
+ library.add(faStepBackward);
88
+ library.add(faClock);
89
+ library.add(faStepForward);
90
+ library.add(faForward);
91
+ library.add(faPlay);
92
+ library.add(faStop);
93
+ library.add(faBorderAll);
94
+ library.add(faSlidersH);
95
+ library.add(faCut);
96
+ library.add(faHourglassStart);
97
+ library.add(faHourglassEnd);
98
+ library.add(faVideo);
99
+ library.add(faInfoCircle);
100
+ library.add(faTachometerAlt);
101
+ library.add(faServer);
102
+ library.add(faEye);
103
+ library.add(faEyeSlash);
104
+ library.add(faBan);
105
+ library.add(faSync);
106
+ library.add(faArrowTurnDown);
107
+ library.add(faArrowCircleDown);
108
+ library.add(faPause);
109
+ }
110
+
111
+ var index = {
112
+ async install(Vue, settings = {}) {
113
+ if (!settings.client || !settings.base_url || !settings.theme?.primary) {
114
+ console.error('Visualization: Missing required settings');
115
+ return
116
+ }
117
+
118
+ if (this.installed) {
119
+ return
120
+ }
121
+ this.installed = true;
122
+
123
+ Vue.use(VTooltip);
124
+ Vue.use(VueMask);
125
+
126
+ registerIcons();
127
+ Vue.component('font-awesome-icon', FontAwesomeIcon);
128
+
129
+ sessionStorage.setItem('server', 'principal');
130
+ sessionStorage.setItem('client', settings.client);
131
+ sessionStorage.setItem('base_url', settings.base_url);
132
+
133
+ const headTag = document.getElementsByTagName('head')[0];
134
+ const styleTag = document.createElement('style');
135
+
136
+ const theme = {
137
+ primary: settings.theme.primary,
138
+ secondary: colorVariation(settings.theme.primary),
139
+ start: settings.theme.start || '#4caf50',
140
+ end: settings.theme.end || '#ff5252',
141
+ };
142
+ let themeCss = [];
143
+ for (const color in theme) {
144
+ themeCss.push(`--visualization-${color}: ${theme[color]};`);
145
+ }
146
+ themeCss = [':root {', ...themeCss, '}'].join(' ');
147
+
148
+ styleTag.innerHTML = themeCss;
149
+ headTag.appendChild(styleTag);
150
+
151
+ Vue.component(
152
+ 'Visualization',
153
+ (await Promise.resolve().then(function () { return Visualization$1; })).default
154
+ );
155
+ },
156
+ };
157
+
158
+ const Status = Object.freeze({
159
+ stopped: 0,
160
+ playing: 1,
161
+ paused: 2,
162
+ });
163
+
164
+ var Frame = {
165
+ render: function(){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{class:{
166
+ 'frame-container': true,
167
+ 'initial-time': _vm.initialTime,
168
+ 'end-time': _vm.endTime,
169
+ 'between-time': _vm.betweenTime,
170
+ active: _vm.active,
171
+ },style:({
172
+ maxHeight: (_vm.maxHeight + "px"),
173
+ width: '100%',
174
+ position: 'relative',
175
+ })},[(_vm.active && _vm.activeTab && _vm.parentComponent.settingsClosed)?_c('GlobalEvents',{on:{"keydown":[function($event){if(!$event.type.indexOf('key')&&$event.keyCode!==32){ return null; }$event.preventDefault();return _vm.playOrPause.apply(null, arguments)},function($event){if(!$event.type.indexOf('key')&&$event.keyCode!==27){ return null; }$event.preventDefault();return _vm.stop.apply(null, arguments)},function($event){if(!$event.type.indexOf('key')&&$event.keyCode!==79){ return null; }return _vm.toogleDetailFrame.apply(null, arguments)},function($event){if(!$event.type.indexOf('key')&&$event.keyCode!==13){ return null; }$event.preventDefault();return _vm.jumpFrameToStart.apply(null, arguments)}]}}):_vm._e(),_vm._v(" "),(_vm.showFrame)?_c('GlobalEvents',{on:{"keydown":[function($event){if(!$event.type.indexOf('key')&&$event.keyCode!==27){ return null; }$event.preventDefault();return _vm.toogleDetailFrame.apply(null, arguments)},function($event){if(!$event.type.indexOf('key')&&$event.keyCode!==13){ return null; }$event.preventDefault();return _vm.toogleDetailFrame.apply(null, arguments)}]}}):_vm._e(),_vm._v(" "),_c('vue-loading',{staticStyle:{"z-index":"0"},attrs:{"active":((!_vm.frame.image || !_vm.frame.time) && _vm.frame.title !== -1) ||
176
+ _vm.loading ||
177
+ _vm.videoIsLoading,"spinner":"ring","color":"#1565c0","background-color":"#ededed","text":_vm.videoIsLoading ? _vm.$('infoBar.createVideo') : ''}}),_vm._v(" "),_c('div',{staticStyle:{"background-color":"black"}},[(!_vm.loading)?_c('div',{class:{
178
+ 'frame-content': _vm.frame.title === -1 || _vm.videoStatus !== _vm.Status.stopped,
179
+ },style:({
180
+ maxHeight: (_vm.height + "px"),
181
+ maxWidth: (_vm.width + "px"),
182
+ color: 'white',
183
+ }),on:{"dblclick":_vm.playOrPause}},[(_vm.frame.image && _vm.videoStatus === _vm.Status.stopped)?_c('div',{class:{ 'dummy-frame': _vm.frame.title === -1 },staticStyle:{"width":"100%","height":"100%"},domProps:{"innerHTML":_vm._s(_vm.frame.image)}}):_vm._e(),_vm._v(" "),(_vm.videoStatus !== _vm.Status.stopped && !_vm.videoIsLoading)?_c('video',{ref:"videoPlayer",staticStyle:{"width":"100%","aspect-ratio":"11/9"},attrs:{"maxHeight":(_vm.height + "px"),"maxWidth":(_vm.width + "px"),"src":_vm.videoUrlString,"preload":"none","autoplay":""},on:{"timeupdate":_vm.updateTimeLabel,"ended":_vm.videoEnded,"click":_vm.playOrPause}}):_vm._e(),_vm._v(" "),_c('div',{staticClass:"overlay"})]):_vm._e()]),_vm._v(" "),_c('dialog',{ref:"imageDetailsDialog",class:{ 'dummy-frame': _vm.frame.title === -1 },staticStyle:{"width":"100vh","border":"none","background":"none"},domProps:{"innerHTML":_vm._s(_vm.frame.image)}})],1)},
184
+ staticRenderFns: [],
185
+ components: {
186
+ VueLoading,
187
+ },
188
+ name: 'frame-component',
189
+ props: {
190
+ frame: {
191
+ type: [Object, Number],
192
+ required: true,
193
+ },
194
+ index: {
195
+ type: Number,
196
+ required: true,
197
+ },
198
+ loading: {
199
+ type: Boolean,
200
+ default: false,
201
+ },
202
+ gridSettings: {
203
+ type: Object,
204
+ required: true,
205
+ },
206
+ initialTime: {
207
+ type: Boolean,
208
+ default: false,
209
+ },
210
+ endTime: {
211
+ type: Boolean,
212
+ default: false,
213
+ },
214
+ betweenTime: {
215
+ type: Boolean,
216
+ default: false,
217
+ },
218
+ active: {
219
+ type: Boolean,
220
+ default: false,
221
+ },
222
+ activeTab: {
223
+ type: Boolean,
224
+ default: false,
225
+ },
226
+ videoUrl: {
227
+ type: [String, Promise],
228
+ required: true,
229
+ },
230
+ playbackRate: {
231
+ type: Number,
232
+ default: 1,
233
+ },
234
+ },
235
+ data() {
236
+ return {
237
+ Status,
238
+ aspectRatio: 11 / 9,
239
+ width: 0,
240
+ height: 0,
241
+ maxWidth: 0,
242
+ fullMaxWidth: 0,
243
+ maxHeight: 0,
244
+ showFrame: false,
245
+ videoStatus: Status.stopped,
246
+ videoStartTime: null,
247
+ videoCurrentTime: null,
248
+ videoUrlString: '',
249
+ parentComponent: null,
250
+ videoIsLoading: false,
251
+ currentBlock: null,
252
+ lastTimeEnterPressed: null,
253
+ }
254
+ },
255
+ created() {
256
+ this.parentComponent = this.$parent;
257
+ },
258
+ watch: {
259
+ playbackRate(val) {
260
+ if (
261
+ this.videoStatus === Status.playing ||
262
+ this.videoStatus === Status.paused
263
+ ) {
264
+ this.$refs.videoPlayer.playbackRate = val;
265
+ }
266
+ },
267
+ },
268
+ methods: {
269
+ jumpFrameToStart() {
270
+ if (this.active) {
271
+ const currentTime = new Date().getTime();
272
+
273
+ if (currentTime - this.lastTimeEnterPressed <= 500) {
274
+ this.parentComponent.changeHour(
275
+ this.parentComponent.convertToAudienceTime(this.frame.time)
276
+ );
277
+ }
278
+
279
+ this.lastTimeEnterPressed = currentTime;
280
+ }
281
+ },
282
+ changeSettings(value) {
283
+ this.videoCurrentTime = value;
284
+ },
285
+ toogleDetailFrame() {
286
+ if (this.showFrame) {
287
+ this.$refs.imageDetailsDialog.close();
288
+ } else {
289
+ this.$refs.imageDetailsDialog.showModal();
290
+ }
291
+ this.showFrame = !this.showFrame;
292
+ },
293
+ getMaxWidth() {
294
+ const commandBarSize = document.getElementById('command-bar');
295
+
296
+ return commandBarSize?.clientWidth
297
+ },
298
+ resize(height) {
299
+ const commandBarSize = document.getElementById('command-bar');
300
+ const infoBarSize = document.getElementById('info-bar');
301
+ this.fullMaxWidth = commandBarSize?.clientWidth;
302
+ this.maxWidth =
303
+ (commandBarSize?.clientWidth - this.gridSettings.framesPerRow * 10) /
304
+ this.gridSettings.framesPerRow;
305
+
306
+ const heightAvailable =
307
+ height -
308
+ commandBarSize?.offsetHeight -
309
+ infoBarSize?.offsetHeight -
310
+ 47 * this.gridSettings.numberOfRows;
311
+
312
+ this.maxHeight =
313
+ this.gridSettings.numberOfRows === 2
314
+ ? (heightAvailable - 12) / 2
315
+ : heightAvailable;
316
+ this.maxHeight = this.maxHeight >= 75 ? this.maxHeight : 75;
317
+
318
+ if (this.maxWidth / this.aspectRatio > this.maxHeight) {
319
+ this.height = this.maxHeight;
320
+ this.width = this.maxHeight * this.aspectRatio;
321
+ } else {
322
+ this.width = this.maxWidth;
323
+ this.height = this.maxWidth / this.aspectRatio;
324
+ }
325
+
326
+ this.maxHeight = this.height;
327
+ },
328
+ async playOrPause() {
329
+ switch (this.videoStatus) {
330
+ case Status.stopped:
331
+ this.videoIsLoading = true;
332
+ try {
333
+ this.videoUrlString = await this.videoUrl;
334
+ const blockInfo =
335
+ await this.parentComponent.fInterface?.getVideoStartTime(
336
+ this.frame
337
+ );
338
+
339
+ this.videoStartTime = blockInfo.start;
340
+ this.videoUrlString =
341
+ this.parentComponent.fInterface.getVideoRequestByUrl(
342
+ blockInfo.url,
343
+ this.frame.number
344
+ );
345
+ } catch (error) {
346
+ console.log(error);
347
+ }
348
+ this.videoIsLoading = false;
349
+ this.videoStatus = Status.playing;
350
+ this.$nextTick(() => {
351
+ this.$refs.videoPlayer.onloadedmetadata = (e) => {
352
+ this.$refs.videoPlayer.playbackRate = this.playbackRate;
353
+ // * atualizar slider
354
+ this.$emit('updateSlider', this.videoStartTime, this.frame.time);
355
+ //*
356
+ this.$emit('startPlaying', this.frame, e.target.duration);
357
+ this.$emit('playPauseStatus', true);
358
+ };
359
+ });
360
+ break
361
+ case Status.paused:
362
+ this.$refs.videoPlayer.play();
363
+ this.$refs.videoPlayer.playbackRate = this.playbackRate;
364
+ this.videoStatus = Status.playing;
365
+ this.$emit('playPauseStatus', true);
366
+ break
367
+ case Status.playing:
368
+ this.$refs.videoPlayer.pause();
369
+
370
+ this.videoStatus = Status.paused;
371
+ this.$emit('playPauseStatus', false);
372
+ break
373
+ }
374
+ },
375
+ stop(jump = true) {
376
+ if (
377
+ this.videoStatus === Status.playing ||
378
+ this.videoStatus === Status.paused
379
+ ) {
380
+ if (jump) {
381
+ this.parentComponent.changeHour(
382
+ this.parentComponent.convertToAudienceTime(
383
+ parseInt(this.videoCurrentTime)
384
+ )
385
+ );
386
+ }
387
+ this.videoStatus = Status.stopped;
388
+ this.videoUrlString = null;
389
+ this.videoCurrentTime = null;
390
+ this.videoStartTime = null;
391
+ }
392
+ this.$emit('stopPlaying');
393
+ },
394
+ //eslint-disable-next-line
395
+ videoJumpTo(time) {
396
+ this.videoCurrentTime = this.videoStartTime + time;
397
+ this.$refs.videoPlayer.currentTime = time;
398
+ },
399
+ async videoJumpToTimeStamp(time) {
400
+ let frame = {
401
+ time: time,
402
+ };
403
+ if (!time) return
404
+ if (
405
+ !(
406
+ this.currentBlock &&
407
+ time >= this.currentBlock.start &&
408
+ time <= this.currentBlock.end
409
+ )
410
+ ) {
411
+ this.currentBlock = await this.parentComponent.fInterface?.getBlockInfo(
412
+ frame
413
+ );
414
+ this.videoStartTime = this.currentBlock.start;
415
+ this.videoUrlString =
416
+ this.parentComponent.fInterface.getVideoUrlForTime(
417
+ this.videoStartTime
418
+ );
419
+ }
420
+ this.videoCurrentTime = time - this.videoStartTime;
421
+ this.$refs.videoPlayer.currentTime = this.videoCurrentTime;
422
+ },
423
+ updateTimeLabel(e) {
424
+ this.videoCurrentTime = this.videoStartTime + e.target.currentTime;
425
+ this.parentComponent.updateVideoTime(this.index, this.videoCurrentTime);
426
+ this.parentComponent.updateVideoStatus(e.target.currentTime);
427
+ },
428
+ async videoEnded() {
429
+ this.videoStartTime =
430
+ await this.parentComponent.fInterface?.getNextVideoStartTime(
431
+ this.frame.time
432
+ );
433
+ this.videoUrlString = this.parentComponent.fInterface.getVideoUrlForTime(
434
+ this.videoStartTime
435
+ );
436
+ // * Ao acabar o vídeo tenho de mandar atualizar slider
437
+ // * aqui o video current time tambem vai ser o videoStartTime
438
+ this.$emit('updateSlider', this.videoStartTime, this.videoStartTime);
439
+ },
440
+ },
441
+ };
442
+
443
+ const Api = axios.create({
444
+ //baseURL: process.env.VUE_APP_FRAMES_SERVER,
445
+ baseURL: sessionStorage.getItem('base_url'),
446
+ });
447
+
448
+ Api.interceptors.request.use((config) => {
449
+ config.params = config.params || {};
450
+ config.params.Client = sessionStorage.getItem('client') || 'UNKNOWN';
451
+ if (sessionStorage.getItem('server') === 'alternative') {
452
+ config.params.BlockPathConfig = 'AlernativeTvConfig';
453
+ }
454
+
455
+ return config
456
+ });
457
+
458
+ var FramesService = {
459
+ getBlockRequest({
460
+ direction,
461
+ channel,
462
+ split,
463
+ time,
464
+ quality,
465
+ factor,
466
+ useCache = true,
467
+ signal,
468
+ } = {}) {
469
+ return Api.get(`Get${direction}FramesBlockInFiles`, {
470
+ params: {
471
+ Channel: channel,
472
+ Split: split,
473
+ UseCache: useCache,
474
+ Time: time,
475
+ Step: 0,
476
+ JpegQuality: quality,
477
+ JpegSizeFactor: factor,
478
+ },
479
+ signal,
480
+ })
481
+ },
482
+
483
+ getSmallBlockRequest({
484
+ channel,
485
+ split,
486
+ time,
487
+ quality,
488
+ factor,
489
+ size,
490
+ useCache = true,
491
+ signal,
492
+ } = {}) {
493
+ return Api.get('GetSmallFramesBlockInFiles', {
494
+ params: {
495
+ Channel: channel,
496
+ Split: split,
497
+ UseCache: useCache,
498
+ Time: time,
499
+ Step: 0,
500
+ JpegQuality: quality,
501
+ JpegSizeFactor: factor,
502
+ Size: size,
503
+ },
504
+ signal,
505
+ })
506
+ },
507
+
508
+ getFileInfoRequest({ direction, channel, split, time, step, signal } = {}) {
509
+ return Api.get(`Get${direction}BlockFileInformation`, {
510
+ params: {
511
+ Channel: channel,
512
+ Split: split,
513
+ Time: time,
514
+ Step: step,
515
+ },
516
+ signal,
517
+ })
518
+ },
519
+
520
+ getNextAvailableBlock({ channel, time, signal } = {}) {
521
+ // process.env.VUE_APP_NEXT_AVAILABLE_BLOCK
522
+
523
+ return Api.get(`GetPreviousAvailableBlockFileInformation`, {
524
+ params: {
525
+ Channel: channel,
526
+ Split: 1,
527
+ Time: time,
528
+ Step: 0,
529
+ },
530
+ signal,
531
+ })
532
+ },
533
+
534
+ // getVideoRequestQuery(direction, channel, split, time, step) {
535
+ // return (
536
+ // this.serverUrl +
537
+ // 'Get' + direction + 'Video' +
538
+ // '?Client=' +
539
+ // client +
540
+ // '&Channel=' +
541
+ // channel +
542
+ // '&Split=' +
543
+ // split +
544
+ // '&Time=' +
545
+ // time +
546
+ // '&Step=' +
547
+ // step +
548
+ // this.serverUrlExtraParams
549
+ // )
550
+ // }
551
+
552
+ // getVideoRequestByTime(channel, time) {
553
+ // return (
554
+ // this.serverUrl +
555
+ // 'GetVideo?channel=' +
556
+ // channel +
557
+ // '&time=' +
558
+ // time +
559
+ // this.serverUrlExtraParams
560
+ // )
561
+ // }
562
+ };
563
+
564
+ var ENUM = {
565
+ MinBlockSizes: Object.freeze({
566
+ 1: 3600,
567
+ 2: 3600,
568
+ 3: 3600,
569
+ 4: 3600,
570
+ 5: 3600,
571
+ }),
572
+
573
+ MinBlockSizesBack: Object.freeze({
574
+ 1: 1800,
575
+ 2: 1800,
576
+ 3: 1800,
577
+ 4: 1800,
578
+ 5: 1800,
579
+ }),
580
+
581
+ Direction: Object.freeze({
582
+ Next: 'Next',
583
+ Previous: 'Previous',
584
+ Self: '',
585
+ }),
586
+
587
+ JpegQuality: Object.freeze({
588
+ LowestQuality: '1',
589
+ LowQuality: '25',
590
+ MediumQuality: '50',
591
+ HighQuality: '75',
592
+ HighestQuality: '100',
593
+ }),
594
+
595
+ ResponseStatus: Object.freeze({
596
+ Ok: 1,
597
+ UnknownError: -1,
598
+ VideoBlockNotFound: -2,
599
+ InvalidRequest: -3,
600
+ ClientNotAllowed: -4,
601
+ AuthenticationProblem: -5,
602
+ }),
603
+
604
+ StepsQuality: Object.freeze({
605
+ 1: '50', // 50 -> MediumQuality of JpegQuality
606
+ 2: '50', // 50 -> MediumQuality of JpegQuality
607
+ 3: '50', // 50 -> MediumQuality of JpegQuality
608
+ 4: '50', // 50 -> MediumQuality of JpegQuality
609
+ 5: '50', // 50 -> MediumQuality of JpegQuality
610
+ }),
611
+
612
+ SizeQuality: Object.freeze({ 1: '100' }), // 100 -> HighestQuality of JpegQuality
613
+
614
+ StepsFactor: Object.freeze({ 1: 1, 2: 1, 3: 1, 4: 1, 5: 1 }),
615
+
616
+ SmallBlockSize: Object.freeze({ 1: 1, 2: 1, 3: 1, 4: 1, 5: 1 }),
617
+ };
618
+
619
+ function FramesManager(
620
+ channel,
621
+ size,
622
+ currentTime,
623
+ startAudienceTime,
624
+ useCache = true
625
+ ) {
626
+ this.channel = channel;
627
+ this.size = size;
628
+ this.currentTime = currentTime;
629
+ this.useCache = useCache;
630
+ this.startAudienceTime = startAudienceTime;
631
+ this.firstFrameTime = currentTime;
632
+
633
+ this.buffer = [];
634
+ this.requests = {};
635
+
636
+ this.currentStep = 1;
637
+ this.currentPosition = 0;
638
+ this.smallBlockSizeFactor = 2;
639
+ this.startCheckingQualityStep = 1;
640
+ this.startCheckingQualitySize = 1;
641
+ this.numberOfSmallBlocksCheck = 3;
642
+ }
643
+
644
+ FramesManager.prototype.goTo = async function (time) {
645
+ this.cancelAllPendingRequests();
646
+
647
+ this.currentTime = time || this.currentTime;
648
+ const frameIndex = this.findFrameIndexByTime(this.currentTime);
649
+
650
+ if (frameIndex >= 0) {
651
+ this.currentPosition = frameIndex;
652
+ } else {
653
+ this.buffer = [];
654
+ await this.getSmallBlock(this.currentTime, this.channel, 1);
655
+ }
656
+ };
657
+
658
+ FramesManager.prototype.getSmallBlock = async function (
659
+ time,
660
+ channel,
661
+ split,
662
+ add = false
663
+ ) {
664
+ const requestId = `smallBlock_${time}`;
665
+ try {
666
+ if (!this.requests[requestId]) {
667
+ this.requests[requestId] = new AbortController();
668
+
669
+ let response = (
670
+ await FramesService.getSmallBlockRequest({
671
+ channel,
672
+ split,
673
+ time,
674
+ size: this.size * 15,
675
+ quality: ENUM.StepsQuality[this.currentStep],
676
+ factor: ENUM.StepsFactor[this.currentStep],
677
+ signal: this.requests[requestId].signal,
678
+ })
679
+ ).data;
680
+
681
+ if (!this.requests[requestId]) {
682
+ throw 'Response not needed anymore'
683
+ }
684
+
685
+ if (response.status !== ENUM.ResponseStatus.Ok) {
686
+ await this.getBlock(time, channel, split, ENUM.Direction.Previous, true);
687
+ await this.getBlock(time, channel, split, ENUM.Direction.Next, true);
688
+ throw response?.message || 'Unknown error'
689
+ }
690
+
691
+ response = response.data;
692
+ const images = response.frames;
693
+ this.requests[`block_${ENUM.Direction.Next}_${response.end}`] = true;
694
+
695
+ this.getBlock(time, this.channel, 1, ENUM.Direction.Self, true, true);
696
+
697
+ if (!add) {
698
+ const firstFrameTime = images[0].time;
699
+ const lastFrameTime = images[images.length - 1].time;
700
+
701
+ if (lastFrameTime === response.end) {
702
+ await this.getSmallBlock(lastFrameTime + 1, this.channel, 1, true);
703
+ } else if (
704
+ this.timestampToTimeString(firstFrameTime) !==
705
+ this.startAudienceTime &&
706
+ firstFrameTime === response.start
707
+ ) {
708
+ await this.getSmallBlock(
709
+ firstFrameTime - this.currentStep * this.size,
710
+ this.channel,
711
+ 1,
712
+ true
713
+ );
714
+ }
715
+ }
716
+
717
+ this.orderFramesBlock(images);
718
+ this.currentPosition = this.findFrameIndexByTime(this.currentTime);
719
+
720
+ delete this.requests[`block_${ENUM.Direction.Next}_${response.end}`];
721
+ delete this.requests[requestId];
722
+ return true
723
+ }
724
+ console.error(`Frames Manager (GetSmallBlock): Request blocked by another equal request occurring`);
725
+ return false
726
+ } catch (err) {
727
+ console.error(`Frames Manager (GetSmallBlock): ${err}`);
728
+ delete this.requests[requestId];
729
+ return false
730
+ }
731
+ };
732
+
733
+ FramesManager.prototype.getBlock = async function (
734
+ time,
735
+ channel,
736
+ split,
737
+ direction,
738
+ checkMinBlock,
739
+ substituition = false
740
+ ) {
741
+ const requestId = `block_${direction}_${time}`;
742
+ try {
743
+ if (!this.requests[requestId]) {
744
+ this.requests[requestId] = new AbortController();
745
+
746
+ let response = (
747
+ await FramesService.getBlockRequest({
748
+ direction,
749
+ channel,
750
+ split,
751
+ time,
752
+ quality: ENUM.StepsQuality[this.currentStep],
753
+ factor: ENUM.StepsFactor[this.currentStep],
754
+ signal: this.requests[requestId].signal,
755
+ })
756
+ ).data;
757
+
758
+ if (!this.requests[requestId]) {
759
+ throw 'Response not needed anymore'
760
+ }
761
+
762
+ if (response.status !== ENUM.ResponseStatus.Ok) {
763
+ throw response?.message || 'Unknown error'
764
+ }
765
+
766
+ this.orderFramesBlock(response.data.frames);
767
+ this.currentPosition = this.findFrameIndexByTime(this.currentTime);
768
+
769
+ if (checkMinBlock) {
770
+ await this.checkMinBlockSize(!substituition);
771
+ }
772
+
773
+ delete this.requests[requestId];
774
+ return true
775
+ }
776
+ console.error(`Frames Manager (GetBlock ${direction}): Request blocked by another equal request occurring`);
777
+ return false
778
+ } catch (err) {
779
+ console.error(`Frames Manager (GetBlock ${direction}): ${err}`);
780
+ delete this.requests[requestId];
781
+ return false
782
+ }
783
+ };
784
+
785
+ FramesManager.prototype.checkMinBlockSize = async function (checkMinBlock) {
786
+ if (this.checkFramesBackward()) {
787
+ await this.getBlock(
788
+ this.buffer.length === 0 ? this.currentTime : this.buffer[0].time,
789
+ this.channel,
790
+ 1,
791
+ ENUM.Direction[this.buffer.length === 0 ? 'Self' : 'Previous'],
792
+ checkMinBlock,
793
+ (this.buffer[0]?.number || 0) !== 0
794
+ );
795
+ }
796
+
797
+ if (this.checkFramesForward()) {
798
+ await this.getBlock(
799
+ this.buffer.length === 0
800
+ ? this.currentTime
801
+ : this.buffer[this.buffer.length - 1].time,
802
+ this.channel,
803
+ 1,
804
+ ENUM.Direction[this.buffer.length === 0 ? 'Self' : 'Next'],
805
+ checkMinBlock
806
+ );
807
+ }
808
+ };
809
+
810
+ FramesManager.prototype.checkFramesForward = function () {
811
+ return (
812
+ this.buffer.length - this.currentPosition <
813
+ ENUM.MinBlockSizes[this.currentStep] * (this.size / 6)
814
+ )
815
+ };
816
+
817
+ FramesManager.prototype.checkFramesBackward = function () {
818
+ return this.currentPosition < ENUM.MinBlockSizesBack[this.currentStep]
819
+ };
820
+
821
+ FramesManager.prototype.orderFramesBlock = function (images) {
822
+ if (this.buffer.length > 0) {
823
+ const bufferFistTime = this.buffer[0].time;
824
+ const bufferLastTime = this.buffer[this.buffer.length - 1].time;
825
+ const beforeImages = images.filter((image) => image.time < bufferFistTime);
826
+ const afterImages = images.filter((image) => image.time > bufferLastTime);
827
+
828
+ this.buffer = [...beforeImages, ...this.buffer, ...afterImages];
829
+ } else {
830
+ this.buffer = images;
831
+ }
832
+ };
833
+
834
+ FramesManager.prototype.findFrameIndexByTime = function (time) {
835
+ return this.buffer.findIndex((frame) => frame.time === time)
836
+ };
837
+
838
+ FramesManager.prototype.cancelAllPendingRequests = function () {
839
+ for (const request in this.requests) {
840
+ const value = this.requests[request];
841
+ if (typeof value === 'object' && 'signal' in value) {
842
+ value.abort();
843
+ }
844
+ delete this.requests[request];
845
+ }
846
+ };
847
+
848
+ FramesManager.prototype.timestampToTimeString = function (timestamp) {
849
+ return new Date(timestamp * 1000)
850
+ .toISOString()
851
+ .substring(11, 19)
852
+ .replace(/:/g, '')
853
+ };
854
+
855
+ FramesManager.prototype.getPrevImages = function () {
856
+ if (this.timestampToTimeString(this.currentTime) === this.startAudienceTime) {
857
+ return null
858
+ }
859
+
860
+ return this.getBufferSlice(
861
+ this.currentPosition - this.size * this.currentStep,
862
+ this.currentPosition
863
+ )
864
+ };
865
+
866
+ FramesManager.prototype.getCurrentImages = function () {
867
+ return this.getBufferSlice(
868
+ this.currentPosition,
869
+ this.currentPosition + this.size * this.currentStep
870
+ )
871
+ };
872
+
873
+ FramesManager.prototype.getNextImages = function () {
874
+ return this.getBufferSlice(
875
+ this.currentPosition + this.size * this.currentStep,
876
+ this.currentPosition + this.size * 2 * this.currentStep
877
+ )
878
+ };
879
+
880
+ FramesManager.prototype.getBufferSlice = function (start, end) {
881
+ let slice = this.buffer.slice(start, end);
882
+
883
+ if (this.currentStep !== 1) {
884
+ slice = slice.filter((f, i) => i % this.currentStep === 0);
885
+ }
886
+
887
+ if (slice.length < this.size) {
888
+ return null
889
+ }
890
+
891
+ return slice
892
+ };
893
+
894
+ FramesManager.prototype.next = function () {
895
+ const newPosition = this.currentPosition + this.currentStep * this.size;
896
+ this.currentPosition =
897
+ newPosition < this.buffer.length ? newPosition : this.currentPosition;
898
+ this.currentTime = this.buffer[this.currentPosition]?.time || this.currentTime;
899
+
900
+ this.checkMinBlockSize(true);
901
+ };
902
+
903
+ FramesManager.prototype.previous = function () {
904
+ const newPosition = this.currentPosition - this.size * this.currentStep;
905
+ this.currentPosition = newPosition > 0 ? newPosition : 0;
906
+ this.currentTime = this.buffer[this.currentPosition]?.time || this.currentTime;
907
+
908
+ this.checkMinBlockSize(true);
909
+ };
910
+
911
+ FramesManager.prototype.getFileInfo = async function (time, step) {
912
+ if (time) {
913
+ let response = (
914
+ await FramesService.getFileInfoRequest({
915
+ direction: ENUM.Direction.Self,
916
+ channel: this.channel,
917
+ split: this.currentStep,
918
+ time: time,
919
+ step: step,
920
+ })
921
+ ).data;
922
+
923
+ if (response.status == ENUM.ResponseStatus.Ok) {
924
+ return response.data
925
+ } else {
926
+ return null
927
+ }
928
+ } else {
929
+ return null
930
+ }
931
+ };
932
+
933
+ FramesManager.prototype.getNextFileInfo = async function (time, step) {
934
+ let response = (
935
+ await FramesService.getFileInfoRequest({
936
+ direction: ENUM.Direction.Next,
937
+ channel: this.channel,
938
+ split: this.currentStep,
939
+ time: time,
940
+ step: step,
941
+ })
942
+ ).data;
943
+
944
+ if (response.status == ENUM.ResponseStatus.Ok) {
945
+ return response.data
946
+ } else {
947
+ return null
948
+ }
949
+ };
950
+
951
+ const server = sessionStorage.getItem('server');
952
+
953
+ function getServerUrlWithParams() {
954
+ return {
955
+ url: sessionStorage.getItem('base_url'),
956
+ params:
957
+ server === 'alternative' ? '&BlockPathConfig=AlernativeTvConfig' : '',
958
+ }
959
+ }
960
+
961
+ function FramesInterface(
962
+ channel,
963
+ numberOfRows,
964
+ framesPerRow,
965
+ currentTime,
966
+ startAudienceTime,
967
+ useCache = true
968
+ ) {
969
+ this.channel = channel;
970
+ this.numberOfRows = numberOfRows;
971
+ this.framesPerRow = framesPerRow;
972
+ this.currentTime = currentTime;
973
+ this.firstFrameTime = currentTime;
974
+ this.startAudienceTime = startAudienceTime;
975
+ this.useCache = useCache;
976
+ }
977
+
978
+ FramesInterface.prototype.init = async function () {
979
+ this.framesManager = await new FramesManager(
980
+ this.channel,
981
+ this.numberOfRows * this.framesPerRow,
982
+ this.currentTime,
983
+ this.startAudienceTime,
984
+ this.useCache
985
+ );
986
+
987
+ await this.framesManager.goTo();
988
+ await this.loadFrames();
989
+ };
990
+
991
+ FramesInterface.prototype.initLight = async function () {
992
+ this.framesManager = await new FramesManager(
993
+ this.channel,
994
+ this.numberOfRows * this.framesPerRow,
995
+ this.currentTime,
996
+ this.startAudienceTime,
997
+ this.useCache
998
+ );
999
+ };
1000
+
1001
+ FramesInterface.prototype.changeTime = async function (time) {
1002
+ await this.framesManager.goTo(time);
1003
+ await this.loadFrames();
1004
+ };
1005
+
1006
+ FramesInterface.prototype.loadFrames = async function () {
1007
+ let prev = (await this.framesManager.getPrevImages()) || [];
1008
+ let next = (await this.framesManager.getNextImages()) || [];
1009
+ let current = (await this.framesManager.getCurrentImages()) || [];
1010
+
1011
+ prev = await this.constructImagesComponent(prev);
1012
+ current = await this.constructImagesComponent(current);
1013
+ next = await this.constructImagesComponent(next);
1014
+
1015
+ this.frames = { prev, current, next };
1016
+ };
1017
+
1018
+ FramesInterface.prototype.loadNextFrames = async function () {
1019
+ this.framesManager.next();
1020
+
1021
+ let next = (await this.framesManager.getNextImages()) || [];
1022
+ next = await this.constructImagesComponent(next);
1023
+
1024
+ this.frames.prev = this.frames.current;
1025
+ this.frames.current = this.frames.next;
1026
+ this.frames.next = next;
1027
+ };
1028
+
1029
+ FramesInterface.prototype.loadPrevFrames = async function () {
1030
+ this.framesManager.previous();
1031
+
1032
+ console.log(this.framesManager.currentTime, this.firstFrameTime);
1033
+
1034
+ if (this.framesManager.currentTime < this.firstFrameTime) {
1035
+ await this.framesManager.goTo(this.firstFrameTime);
1036
+ await this.loadFrames();
1037
+ return
1038
+ }
1039
+
1040
+ let prev = (await this.framesManager.getPrevImages()) || [];
1041
+ prev = await this.constructImagesComponent(prev);
1042
+
1043
+ this.frames.next = this.frames.current;
1044
+ this.frames.current = this.frames.prev;
1045
+ this.frames.prev = prev;
1046
+ };
1047
+
1048
+ FramesInterface.prototype.constructImagesComponent = async function (array) {
1049
+ const Semaphor = [];
1050
+ for (let frame of array) {
1051
+ const image = document.createElement('img');
1052
+ image.src =
1053
+ frame.title === -1
1054
+ ? null
1055
+ : `${sessionStorage.getItem('base_url')}frames/${frame.title}${
1056
+ server == 'alternative' ? '?server=alt' : ''
1057
+ }`;
1058
+
1059
+ image.style.maxWidth = frame.title === -1 ? '80%' : '100%';
1060
+ image.style.contain = 'true';
1061
+ Semaphor.push(
1062
+ new Promise((resolve) => {
1063
+ image.addEventListener('load', () => {
1064
+ resolve();
1065
+ });
1066
+ })
1067
+ );
1068
+
1069
+ frame['image'] = image.outerHTML;
1070
+ }
1071
+ await Promise.all(Semaphor);
1072
+ return array
1073
+ };
1074
+
1075
+ FramesInterface.prototype.getFrames = function (position) {
1076
+ const positions = ['prev', 'current', 'next'];
1077
+ const images = this.frames[positions[position]];
1078
+ if (images && images.length > 0) {
1079
+ return images
1080
+ }
1081
+ return Array.from(Array(this.numberOfRows * this.framesPerRow).keys())
1082
+ };
1083
+
1084
+ FramesInterface.prototype.getCurrentTime = function () {
1085
+ return this.framesManager.currentTime
1086
+ };
1087
+
1088
+ FramesInterface.prototype.getVideoUrl = function (frame) {
1089
+ let { url, params } = getServerUrlWithParams();
1090
+ return (
1091
+ url +
1092
+ 'GetVideo?Client=' +
1093
+ sessionStorage.getItem('client') +
1094
+ '&Channel=' +
1095
+ this.channel +
1096
+ '&Time=' +
1097
+ frame.time +
1098
+ params +
1099
+ '#t=' +
1100
+ frame.number
1101
+ )
1102
+ };
1103
+
1104
+ FramesInterface.prototype.getVideoUrlForTime = function (time) {
1105
+ let { url, params } = getServerUrlWithParams();
1106
+ return (
1107
+ url +
1108
+ 'GetVideo?Client=' +
1109
+ sessionStorage.getItem('client') +
1110
+ '&Channel=' +
1111
+ this.channel +
1112
+ '&Time=' +
1113
+ time +
1114
+ params
1115
+ )
1116
+ };
1117
+
1118
+ FramesInterface.prototype.getVideoStartTime = async function (frame) {
1119
+ try {
1120
+ const block = await this.framesManager.getFileInfo(frame.time, 0);
1121
+ return block
1122
+ } catch (err) {
1123
+ console.log(err);
1124
+ }
1125
+ };
1126
+
1127
+ FramesInterface.prototype.getBlockInfo = async function (frame) {
1128
+ try {
1129
+ const block = await this.framesManager.getFileInfo(frame.time, 0);
1130
+ return block
1131
+ } catch (err) {
1132
+ console.log(err);
1133
+ }
1134
+ };
1135
+
1136
+ FramesInterface.prototype.getNextVideoStartTime = async function (time) {
1137
+ try {
1138
+ const block = await this.framesManager.getNextFileInfo(time, 0);
1139
+ return block.start
1140
+ } catch (err) {
1141
+ console.log(err);
1142
+ }
1143
+ };
1144
+
1145
+ FramesInterface.prototype.setCurrentStep = function (step) {
1146
+ this.framesManager.currentStep = step;
1147
+ };
1148
+
1149
+ FramesInterface.prototype.changeSize = async function (
1150
+ numberOfRows,
1151
+ framesPerRow
1152
+ ) {
1153
+ this.numberOfRows = numberOfRows;
1154
+ this.framesPerRow = framesPerRow;
1155
+ this.framesManager.size = this.numberOfRows * this.framesPerRow;
1156
+ await this.loadFrames();
1157
+ };
1158
+
1159
+ FramesInterface.prototype.getVideoRequestByUrl = function (url_path, t) {
1160
+ const { url, params } = getServerUrlWithParams();
1161
+ return url + 'StreamFromVideo?url=' + url_path + params + '#t=' + t
1162
+ };
1163
+
1164
+ var Commands = {
1165
+ render: function(){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"visualization-col pa-0",staticStyle:{"border-top-right-radius":"6px"},attrs:{"id":"command-bar"}},[(_vm.commandBarShow)?_c('div',{staticClass:"visualization-row visualization-justify-center"},_vm._l((_vm.commandBarBtns),function(btn,index){return _c('div',{key:'command-btn-' + index},[(!btn)?_c('hr',{staticClass:"visualization-divider vertical",staticStyle:{"margin":"0 4px"}}):_vm._e(),_vm._v(" "),(btn && (btn.condition ? btn.condition() : true))?_c('button',{directives:[{name:"tooltip",rawName:"v-tooltip",value:(
1166
+ btn.text && typeof btn.text === 'function' ? btn.text() : btn.text
1167
+ ),expression:"\n btn.text && typeof btn.text === 'function' ? btn.text() : btn.text\n "}],staticClass:"command-bar-btn",style:({
1168
+ color:
1169
+ btn.color && typeof btn.color === 'function'
1170
+ ? btn.color()
1171
+ : 'black',
1172
+ }),on:{"click":btn.fnc}},[_c('font-awesome-icon',{attrs:{"id":btn.id,"icon":'fa-solid ' +
1173
+ (btn.icon && typeof btn.icon === 'function'
1174
+ ? btn.icon()
1175
+ : btn.icon)}})],1):_vm._e()])}),0):_vm._e(),_vm._v(" "),_c('hr',{staticClass:"visualization-divider"})])},
1176
+ staticRenderFns: [],
1177
+ props: {
1178
+ videoPlaying: {
1179
+ type: Boolean,
1180
+ default: false,
1181
+ },
1182
+ videoPaused: {
1183
+ type: Boolean,
1184
+ default: false,
1185
+ },
1186
+ insertTime: {
1187
+ type: Boolean,
1188
+ default: false,
1189
+ },
1190
+ hourIniSelected: {
1191
+ type: Boolean,
1192
+ default: false,
1193
+ },
1194
+ hourEndSelected: {
1195
+ type: Boolean,
1196
+ default: false,
1197
+ },
1198
+ },
1199
+ data() {
1200
+ return {
1201
+ commandBarShow: true,
1202
+ commandBarBtns: [
1203
+ {
1204
+ fnc: () => this.$emit('prev-loop-activate'),
1205
+ icon: 'fa-backward',
1206
+ text: 'Fast Backward',
1207
+ id: 'Fast Backward',
1208
+ },
1209
+ {
1210
+ fnc: () => this.$emit('prev'),
1211
+ icon: 'fa-step-backward',
1212
+ text: 'Step Backward',
1213
+ id: 'Step Backward',
1214
+ },
1215
+ {
1216
+ fnc: () => this.$emit('go-to'),
1217
+ icon: 'fa-clock',
1218
+ text: this.$i18n.t('infoBar.setHour'),
1219
+ id: 'Definir Hora',
1220
+ },
1221
+ {
1222
+ fnc: () => this.$emit('next'),
1223
+ icon: 'fa-step-forward',
1224
+ text: 'Step Forward',
1225
+ id: 'Step Forward',
1226
+ },
1227
+ {
1228
+ fnc: () => this.$emit('next-loop-activate'),
1229
+ icon: 'fa-forward',
1230
+ text: 'Fast Forward',
1231
+ id: 'Fast Forward',
1232
+ },
1233
+ {
1234
+ fnc: () => this.$emit('play-or-pause'),
1235
+ icon: () => {
1236
+ return this.videoPlaying && !this.videoPaused
1237
+ ? 'fa-pause'
1238
+ : 'fa-play'
1239
+ },
1240
+ text: () => {
1241
+ return this.videoPlaying && !this.videoPaused ? 'Pause' : 'Play'
1242
+ },
1243
+ id: 'playOrPause',
1244
+ },
1245
+ {
1246
+ fnc: () => this.$emit('stop-playing'),
1247
+ icon: 'fa-stop',
1248
+ text: 'Stop',
1249
+ id: 'Stop',
1250
+ },
1251
+ null,
1252
+ {
1253
+ fnc: () => this.$emit('open-frame-selection'),
1254
+ icon: 'fa-border-all',
1255
+ text: this.$i18n.t('infoBar.gridForm'),
1256
+ id: 'Formato da grelha',
1257
+ },
1258
+ {
1259
+ fnc: () => this.$emit('open-frames-per-second'),
1260
+ icon: 'fa-sliders-h',
1261
+ text: this.$i18n.t('infoBar.secondImage'),
1262
+ id: 'Segundos por Imagem',
1263
+ },
1264
+ // {
1265
+ // fnc: () => this.$emit('open-blocks'),
1266
+ // icon: 'fa-cut',
1267
+ // text: 'Escolher intervalo de blocos',
1268
+ // id: 'Escolher intervalo de blocos',
1269
+ // },
1270
+ {
1271
+ fnc: () => this.$emit('open-playback-rate'),
1272
+ icon: 'fa-tachometer-alt',
1273
+ text: this.$i18n.t('infoBar.chooseVelocity'),
1274
+ id: 'Escolher velocidade de reprodução',
1275
+ },
1276
+ // {
1277
+ // fnc: () => this.$emit('insert-time-force'),
1278
+ // icon: 'fa-arrow-turn-down',
1279
+ // text: 'Recuperar Notícia',
1280
+ // id: 'Recuperar Notícia',
1281
+ // condition: () => {
1282
+ // return this.insertTime
1283
+ // },
1284
+ // },
1285
+ null,
1286
+ {
1287
+ fnc: () => this.$emit('set-hour-ini'),
1288
+ icon: 'fa-hourglass-start',
1289
+ text: this.$i18n.t('form.inicialHour'),
1290
+ id: 'Hora Inicial',
1291
+ color: () => {
1292
+ return this.hourIniSelected ? 'var(--visualization-start)' : 'black'
1293
+ },
1294
+ },
1295
+ {
1296
+ fnc: () => this.$emit('insert-time'),
1297
+ icon: 'fa-arrow-circle-down',
1298
+ text: this.$i18n.t('infoBar.insert'),
1299
+ id: 'insert',
1300
+ condition: () => {
1301
+ return this.insertTime
1302
+ },
1303
+ },
1304
+ {
1305
+ fnc: () => this.$emit('set-hour-end'),
1306
+ icon: 'fa-hourglass-end',
1307
+ text: this.$i18n.t('form.endHour'),
1308
+ id: 'Hora Final',
1309
+ color: () => {
1310
+ return this.hourEndSelected ? 'var(--visualization-end)' : 'black'
1311
+ },
1312
+ },
1313
+ // {
1314
+ // fnc: () => this.$emit('check-available-block'),
1315
+ // icon: 'fa-video',
1316
+ // text: 'Próximo bloco disponível',
1317
+ // id: 'Próximo bloco disponível',
1318
+ // },
1319
+ ],
1320
+ }
1321
+ },
1322
+ };
1323
+
1324
+ var Infos = {
1325
+ render: function(){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"visualization-row visualization-justify-center visualization-align-center",style:(!_vm.commandsShow
1326
+ ? 'border-top-right-radius: 6px; padding: 4px'
1327
+ : 'padding: 4px'),attrs:{"id":"info-bar"}},[_c('span',[_vm._v(" "+_vm._s(_vm.playbackRate)+"x ")]),_vm._v(" "),_c('hr',{staticClass:"visualization-divider vertical",staticStyle:{"margin":"0 8px"}}),_vm._v(" "),_c('span',[_vm._v("\n "+_vm._s(_vm.$t('infoBar.selected', {
1328
+ seconds: _vm.hourEnd && _vm.hourIni ? _vm.hourEnd - _vm.hourIni + 1 : 0,
1329
+ hour_ini: _vm.convertToAudienceTime(_vm.hourIni),
1330
+ hour_end: _vm.convertToAudienceTime(_vm.hourEnd),
1331
+ }))+"\n ")]),_vm._v(" "),_c('hr',{staticClass:"visualization-divider vertical",staticStyle:{"margin":"0 8px"}}),_vm._v(" "),_c('span',[_vm._v("\n "+_vm._s(_vm.$t('infoBar.interval', {
1332
+ seconds: _vm.secondsPerFrame,
1333
+ }))+"\n ")]),_vm._v(" "),_c('hr',{staticClass:"visualization-divider vertical",staticStyle:{"margin":"0 8px"}}),_vm._v(" "),_c('span',[_vm._v("\n "+_vm._s(_vm.$t('infoBar.block', {
1334
+ time1: _vm.convertToAudienceTime(_vm.blockStartTime),
1335
+ time2: _vm.convertToAudienceTime(_vm.blockTotalTime),
1336
+ }))+"\n ")]),_vm._v(" "),_c('hr',{staticClass:"visualization-divider vertical",staticStyle:{"margin":"0 8px"}}),_vm._v("\n "+_vm._s(_vm.framesPerRow * _vm.numberOfRows)+"\n "),_c('hr',{staticClass:"visualization-divider vertical",staticStyle:{"margin":"0 8px"}}),_vm._v("\n "+_vm._s(_vm.framesPerRow + '*' + _vm.numberOfRows)+"\n "),(_vm.alternativeServer || !_vm.cache)?_c('span',{staticClass:"visualization-divider vertical",staticStyle:{"margin":"0 8px"}}):_vm._e(),_vm._v(" "),(_vm.alternativeServer)?_c('span',[_c('v-icon',{attrs:{"color":"error","small":"","left":""}},[_vm._v("fa-exclamation-triangle")]),_vm._v(" "),_c('strong',[_vm._v(_vm._s(_vm.$t('infoBar.alternativeServer')))])],1):_vm._e(),_vm._v(" "),(_vm.alternativeServer && !_vm.cache)?_c('span',{staticClass:"visualization-divider vertical",staticStyle:{"margin":"0 8px"}}):_vm._e(),_vm._v(" "),(!_vm.cache)?_c('span',[_c('v-icon',{attrs:{"color":"warning","small":"","left":""}},[_vm._v("fa-exclamation-circle")]),_vm._v(" "),_c('strong',[_vm._v(_vm._s(_vm.$t('infoBar.notUsingCache')))])],1):_vm._e(),_vm._v(" "),_c('div',{staticClass:"settings-container"},[_c('font-awesome-icon',{directives:[{name:"tooltip",rawName:"v-tooltip",value:(
1337
+ _vm.alternativeServer
1338
+ ? _vm.$t('infoBar.changeServer')
1339
+ : _vm.$t('infoBar.changeServer')
1340
+ ),expression:"\n alternativeServer\n ? $t('infoBar.changeServer')\n : $t('infoBar.changeServer')\n "}],attrs:{"icon":"fa-solid fa-server"},on:{"click":function($event){return _vm.$emit('change-server')}}}),_vm._v(" "),_c('font-awesome-icon',{directives:[{name:"tooltip",rawName:"v-tooltip",value:(
1341
+ _vm.commandsShow
1342
+ ? _vm.$t('moduletelentry.hideButtons')
1343
+ : _vm.$t('moduletelentry.showButtons')
1344
+ ),expression:"\n commandsShow\n ? $t('moduletelentry.hideButtons')\n : $t('moduletelentry.showButtons')\n "}],attrs:{"icon":_vm.commandsShow ? 'fa-solid fa-eye' : 'fa-solid fa-eye-slash'},on:{"click":function($event){return _vm.$emit('toogle-commands-visibility')}}}),_vm._v(" "),_c('font-awesome-icon',{directives:[{name:"tooltip",rawName:"v-tooltip",value:(
1345
+ _vm.cache ? _vm.$t('infoBar.disableCache') : _vm.$t('infoBar.activateCache')
1346
+ ),expression:"\n cache ? $t('infoBar.disableCache') : $t('infoBar.activateCache')\n "}],attrs:{"icon":_vm.cache ? 'fa-solid fa-ban' : 'fa-solid fa-sync'},on:{"click":function($event){return _vm.$emit('toogle-cache')}}})],1)])},
1347
+ staticRenderFns: [],
1348
+ props: {
1349
+ playbackRate: {
1350
+ type: Number,
1351
+ required: true,
1352
+ },
1353
+ secondsPerFrame: {
1354
+ type: Number,
1355
+ required: true,
1356
+ },
1357
+ commandsShow: {
1358
+ type: Boolean,
1359
+ required: true,
1360
+ },
1361
+ cache: {
1362
+ type: Boolean,
1363
+ required: true,
1364
+ },
1365
+ blockStartTime: {
1366
+ type: Number,
1367
+ required: true,
1368
+ },
1369
+ videoTotalDuration: {
1370
+ type: Number,
1371
+ required: true,
1372
+ },
1373
+ alternativeServer: {
1374
+ type: Boolean,
1375
+ required: true,
1376
+ },
1377
+ framesPerRow: {
1378
+ type: Number,
1379
+ required: true,
1380
+ },
1381
+ numberOfRows: {
1382
+ type: Number,
1383
+ required: true,
1384
+ },
1385
+ hourIni: {
1386
+ type: [Number, Boolean],
1387
+ },
1388
+ hourEnd: {
1389
+ type: [Number, Boolean],
1390
+ },
1391
+ },
1392
+ data() {
1393
+ return {}
1394
+ },
1395
+ computed: {
1396
+ blockTotalTime() {
1397
+ return this.videoTotalDuration + this.blockStartTime
1398
+ },
1399
+ },
1400
+ methods: {
1401
+ convertToAudienceTime(time, separator = ':') {
1402
+ const d = this.getDateParts();
1403
+ const limit = Date.UTC(d.year, d.month, d.day, 23, 59, 59) / 1000;
1404
+
1405
+ let hour = this.dateInUtc(time * 1000)
1406
+ .toTimeString()
1407
+ .split(' ')[0]
1408
+ .split(':')
1409
+ .map(Number);
1410
+
1411
+ if (time > limit && time <= limit + this.startAudienceSeconds) {
1412
+ hour[0] = 24 + hour[0];
1413
+ }
1414
+ return hour
1415
+ .map((part) => (part > 9 ? part.toString() : '0' + part))
1416
+ .join(separator)
1417
+ },
1418
+ getDateParts(date = this.date) {
1419
+ const d = new Date(date);
1420
+ return {
1421
+ year: d.getFullYear(),
1422
+ month: d.getMonth(),
1423
+ day: d.getDate(),
1424
+ }
1425
+ },
1426
+ dateInUtc(miliSeconds) {
1427
+ var date = new Date(miliSeconds);
1428
+ var utc = new Date(
1429
+ date.getUTCFullYear(),
1430
+ date.getUTCMonth(),
1431
+ date.getUTCDate(),
1432
+ date.getUTCHours(),
1433
+ date.getUTCMinutes(),
1434
+ date.getUTCSeconds()
1435
+ );
1436
+ return utc
1437
+ },
1438
+ },
1439
+ };
1440
+
1441
+ var VideoProgress = {
1442
+ render: function(){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',[_c('div',{staticClass:"visualization-row",attrs:{"id":"progress"},on:{"mousedown":_vm.progressMouseDown}},[_c('span',{staticClass:"progressLabel"},[_vm._v("\n "+_vm._s(_vm.convertToAudienceTime(_vm.videoTime))+"\n ")]),_vm._v(" "),_c('span',{staticClass:"progressBar"})]),_vm._v(" "),_c('hr',{staticClass:"visualization-divider"})])},
1443
+ staticRenderFns: [],
1444
+ props: {
1445
+ videoTime: {
1446
+ type: Number,
1447
+ required: true,
1448
+ },
1449
+ },
1450
+ methods: {
1451
+ progressMouseDown(e) {
1452
+ this.progressVideoDrag = true;
1453
+ const array = this.$refs.frames.filter(
1454
+ (fc) => fc.videoStatus === fc.Status.playing
1455
+ );
1456
+ if (array.length === 1) {
1457
+ const frame = array[0];
1458
+ frame.playOrPause();
1459
+ }
1460
+ this.updateProgress(e);
1461
+
1462
+ window.addEventListener('mouseup', this.progressMouseUp);
1463
+ window.addEventListener('mousemove', this.progressMouseMove);
1464
+ },
1465
+ progressMouseUp(e) {
1466
+ if (this.progressVideoDrag) {
1467
+ const array = this.$refs.frames.filter(
1468
+ (fc) => fc.videoStatus === fc.Status.paused
1469
+ );
1470
+ if (array.length === 1) {
1471
+ const frame = array[0];
1472
+ frame.playOrPause();
1473
+ }
1474
+
1475
+ this.updateProgress(e);
1476
+ }
1477
+
1478
+ window.removeEventListener('mouseup', this.progressMouseUp);
1479
+ window.removeEventListener('mousemove', this.progressMouseMove);
1480
+ this.progressVideoDrag = false;
1481
+ },
1482
+ progressMouseMove(e) {
1483
+ if (this.progressVideoDrag) {
1484
+ this.updateProgress(e);
1485
+ }
1486
+ },
1487
+ updateProgress(e, time) {
1488
+ let percentage;
1489
+ const element = document.getElementById('progress');
1490
+ const elementBar = element.getElementsByClassName('progressBar')[0];
1491
+
1492
+ let frames = this.$refs.frames.filter(
1493
+ (fc) =>
1494
+ fc.videoStatus === fc.Status.playing ||
1495
+ fc.videoStatus === fc.Status.paused
1496
+ );
1497
+ let frame = frames.length === 1 ? frames[0] : null;
1498
+
1499
+ if (time && frame) {
1500
+ let timeInSeconds = frame.videoCurrentTime - this.sliderStartTime;
1501
+
1502
+ percentage = (timeInSeconds / this.videoSliderTotalDuration) * 100;
1503
+ } else if (e) {
1504
+ const rect = element.getBoundingClientRect();
1505
+ const max = Math.round(rect.width);
1506
+ const pos = e.pageX - Math.round(rect.left);
1507
+ percentage = (pos / max) * 100 <= 100 ? (pos / max) * 100 : 100;
1508
+
1509
+ if (frame) {
1510
+ let targetInSeconds =
1511
+ this.videoSliderTotalDuration * (percentage / 100);
1512
+ let timeStampToJump = parseInt(this.sliderStartTime + targetInSeconds);
1513
+ frame.videoJumpToTimeStamp(timeStampToJump);
1514
+ }
1515
+ } else {
1516
+ percentage = 0;
1517
+ }
1518
+
1519
+ elementBar.style.width = `${percentage}%`;
1520
+ },
1521
+ getDateParts(date = this.date) {
1522
+ const d = new Date(date);
1523
+ return {
1524
+ year: d.getFullYear(),
1525
+ month: d.getMonth(),
1526
+ day: d.getDate(),
1527
+ }
1528
+ },
1529
+ dateInUtc(miliSeconds) {
1530
+ var date = new Date(miliSeconds);
1531
+ var utc = new Date(
1532
+ date.getUTCFullYear(),
1533
+ date.getUTCMonth(),
1534
+ date.getUTCDate(),
1535
+ date.getUTCHours(),
1536
+ date.getUTCMinutes(),
1537
+ date.getUTCSeconds()
1538
+ );
1539
+ return utc
1540
+ },
1541
+ convertToAudienceTime(time, separator = ':') {
1542
+ const d = this.getDateParts();
1543
+ const limit = Date.UTC(d.year, d.month, d.day, 23, 59, 59) / 1000;
1544
+
1545
+ let hour = this.dateInUtc(time * 1000)
1546
+ .toTimeString()
1547
+ .split(' ')[0]
1548
+ .split(':')
1549
+ .map(Number);
1550
+
1551
+ if (time > limit && time <= limit + this.startAudienceSeconds) {
1552
+ hour[0] = 24 + hour[0];
1553
+ }
1554
+ return hour
1555
+ .map((part) => (part > 9 ? part.toString() : '0' + part))
1556
+ .join(separator)
1557
+ },
1558
+ },
1559
+ };
1560
+
1561
+ var one_one = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 558.2 183.6\" xmlns:v=\"https://vecta.io/nano\"><path d=\"M558.2 0v90.1h-88.3c-1.9 0-1.9 0-1.9-1.9V1.8c0-1.8 0-1.8 1.8-1.8h88.4zm-468 183.5H0V95.1c0-1.7 0-1.7 1.7-1.7h86.7c1.8 0 1.8 0 1.8 1.8v88.3zm93.6 0H93.6V95.3c0-1.9 0-1.9 1.9-1.9H182c1.8 0 1.8 0 1.8 1.8v88.3zm280.9 0h-90.2V95.1c0-1.7 0-1.7 1.6-1.7H463c1.6 0 1.6 0 1.6 1.7v62.2l.1 26.2zm93.5-90v89c0 .9-.2 1.1-1.1 1.1H468V95.2c0-1.7 0-1.7 1.7-1.7h88.5zm-280.9 90h-90V94.9c0-.9.1-1.5 1.2-1.5H276c.9 0 1.2.3 1.2 1.2l.1 88.9zm93.6 0h-90V95.1c0-1.7 0-1.7 1.7-1.7h86.5c1.8 0 1.8 0 1.8 1.8v88.3z\" fill=\"#cbcbcb\"/><path d=\"M0 45.1V1.5C0 .3.3 0 1.4 0h87.3c1.2 0 1.5.3 1.4 1.5v87.1c0 1.2-.3 1.5-1.5 1.5H1.4c-1.3 0-1.5-.4-1.5-1.6L0 45.1z\" fill=\"#1565c0\"/><path d=\"M93.6 44.9V1.5c0-1.6 0-1.6 1.6-1.6h87.1c1.5 0 1.5 0 1.5 1.6v86.8c0 1.6 0 1.6-1.6 1.6H95.4c-1.8 0-1.8 0-1.8-1.8V44.9zm280.9.2V1.6c0-1.6 0-1.6 1.6-1.6h87.1c1.5 0 1.5 0 1.5 1.6v86.7c0 1.8 0 1.8-1.8 1.8h-86.7c-1.7 0-1.7 0-1.7-1.7V45.1zm-142.1 45H189c-1.6 0-1.6 0-1.6-1.5v-87c0-1.6 0-1.6 1.6-1.6h86.8c1.6 0 1.6 0 1.6 1.5v87c0 1.6 0 1.6-1.6 1.6h-43.4zm48.5-45.2V1.5c0-1.6 0-1.6 1.6-1.6h86.8c1.6 0 1.6 0 1.6 1.5v87c0 1.6 0 1.6-1.6 1.6h-86.8c-1.6 0-1.6 0-1.6-1.6V44.9z\" fill=\"#cbcbcb\"/></svg>";
1562
+
1563
+ var two_one = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 558.2 183.6\" xmlns:v=\"https://vecta.io/nano\"><path d=\"M277.3 183.5h-90.2V94.2c0-.6.2-.9.8-.9h87.7c1 0 1.6 0 1.6 1.3l.1 88.9zM558.2 0v90.1h-88.3c-1.9 0-1.9 0-1.9-1.9V1.8c0-1.8 0-1.8 1.8-1.8h88.4zm-468 183.5H0V95.1c0-1.7 0-1.7 1.7-1.7h86.7c1.8 0 1.8 0 1.8 1.8v88.3zm93.6 0H93.6V95.3c0-1.9 0-1.9 1.9-1.9H182c1.8 0 1.8 0 1.8 1.8v88.3zm280.9 0h-90.2V95.1c0-1.7 0-1.7 1.6-1.7H463c1.6 0 1.6 0 1.6 1.7v61.2l.1 27.2zm93.5-90v89c0 .9-.2 1.1-1.1 1.1H468V95.2c0-1.7 0-1.7 1.7-1.7h88.5zm-187.1 90h-90.2V94.6c0-1.1.4-1.5 1.5-1.5l6.8.3h80.2c1.1 0 1.5.2 1.5 1.4l.2 61.9.5 25.1c0 .7.1 1.3-.5 1.7z\" fill=\"#cbcbcb\"/><path d=\"M183.8 45.1v43.5c0 1.1-.2 1.6-1.5 1.6H95c-1.2 0-1.4-.4-1.4-1.5V1.5C93.6.2 94 0 95.1 0h87.3c1.2 0 1.4.4 1.4 1.5v43.6zM45.1 0h43.7c1.1 0 1.4.2 1.4 1.4v87.3c0 1.1-.4 1.4-1.4 1.4H1.4c-1.1 0-1.3-.3-1.3-1.3L0 1.3C0 .2.3 0 1.3 0h43.8z\" fill=\"#1565c0\"/><path d=\"M419.6 90.1h-43.5c-1.6 0-1.6 0-1.6-1.6V1.6c0-1.6 0-1.6 1.6-1.6h87.1c1.5 0 1.5 0 1.5 1.6v86.7c0 1.8 0 1.8-1.8 1.8h-43.3zM277.3 44.9v43.5c0 1.7 0 1.7-1.6 1.7h-86.8c-1.6 0-1.6 0-1.6-1.6v-87c0-1.5 0-1.5 1.6-1.5h86.8c1.6 0 1.6 0 1.6 1.6v43.3zm93.6.3v43.2c0 1.7 0 1.7-1.6 1.7h-86.8c-1.6 0-1.6 0-1.6-1.6v-87c0-1.5 0-1.5 1.6-1.5h86.8c1.6 0 1.6 0 1.6 1.6v43.6z\" fill=\"#cbcbcb\"/></svg>";
1564
+
1565
+ var three_one = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 558.2 183.6\" xmlns:v=\"https://vecta.io/nano\"><path d=\"M277.3 183.5h-90.2V94.2c0-.6.2-.9.8-.9h87.8c1 0 1.6 0 1.6 1.3v88.9zM558.2 0v90.1h-88.3c-1.9 0-1.9 0-1.9-1.9V1.8c0-1.8 0-1.8 1.8-1.8h88.4zm-468 183.5H0V95.1c0-1.7 0-1.7 1.7-1.7h86.7c1.8 0 1.8 0 1.8 1.8v88.3zm93.6 0H93.6V95.3c0-1.9 0-1.9 1.9-1.9H182c1.8 0 1.8 0 1.8 1.8v88.3zm280.9 0h-90.2V95.1c0-1.7 0-1.7 1.6-1.7H463c1.6 0 1.6 0 1.6 1.7V157l.1 26.5zm93.5-90v89c0 .9-.2 1.1-1.1 1.1H468V95.2c0-1.7 0-1.7 1.7-1.7h88.5zm-187.1 90h-90.2V94.6c0-1.1.4-1.5 1.5-1.5l6.8.3h80.2c1.1 0 1.5.2 1.5 1.4l.2 61.9.5 25.1c0 .7.1 1.3-.5 1.7z\" fill=\"#cbcbcb\"/><path d=\"M45.1 90.1H1.4c-1.1 0-1.5-.3-1.5-1.4L0 1.5C0 .3.3 0 1.5 0h87.3c1.2 0 1.4.4 1.4 1.5v87.1c0 1.2-.3 1.5-1.5 1.5H45.1zM138.8 0h43.5c1.1 0 1.5.3 1.5 1.4v87.2c0 1.2-.3 1.4-1.5 1.4H95.1c-1.2 0-1.5-.3-1.5-1.5V1.4C93.6.2 94 0 95.1 0h43.7z\" fill=\"#1565c0\"/><path d=\"M374.5 45.1V1.6c0-1.6 0-1.6 1.6-1.6h87.1c1.6 0 1.6 0 1.6 1.6v86.8c0 1.7 0 1.7-1.7 1.7h-86.9c-1.6 0-1.6 0-1.6-1.5l-.1-43.5z\" fill=\"#cbcbcb\"/><path d=\"M277.3 45.1v43.5c0 1.5 0 1.5-1.6 1.5h-86.9c-1.5 0-1.5 0-1.5-1.6V1.6c0-1.2.2-1.6 1.5-1.5H276c1.2 0 1.4.4 1.4 1.5l-.1 43.5z\" fill=\"#1565c0\"/><path d=\"M370.9 45.2v43.2c0 1.7 0 1.7-1.6 1.7h-86.8c-1.6 0-1.6 0-1.6-1.6v-87c0-1.5 0-1.5 1.6-1.5h86.8c1.6 0 1.6 0 1.6 1.6v43.6z\" fill=\"#cbcbcb\"/></svg>";
1566
+
1567
+ var three_two = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 558.2 183.6\" xmlns:v=\"https://vecta.io/nano\"><path d=\"M277.3 183.5h-90.2V95c0-1.6 0-1.6 1.6-1.6h86.9c1.7 0 1.7 0 1.7 1.7v88.4z\" fill=\"#1565c0\"/><path d=\"M558.2 0v90.1h-88.3c-1.9 0-1.9 0-1.9-1.9V1.8c0-1.8 0-1.8 1.8-1.8h88.4z\" fill=\"#cbcbcb\"/><path d=\"M90.2 183.5H0V95.2c0-1.9-.2-1.8 1.7-1.8h86.7c1.7 0 1.7 0 1.7 1.8v86.6c.1.6.1 1.2.1 1.7zm93.6 0H93.6V95.2c0-1.8 0-1.8 1.7-1.8H182c1.9 0 1.7-.2 1.7 1.8l.1 88.3z\" fill=\"#1565c0\"/><path d=\"M464.7 183.5h-90.2V95.1c0-1.7 0-1.7 1.6-1.7H463c1.6 0 1.6 0 1.6 1.7v62.6l.1 25.8zm93.5-90v89c0 .9-.2 1.1-1.1 1.1H468V95.2c0-1.7 0-1.7 1.7-1.7h88.5zm-187.1 90h-90.2V94.6c0-1.1.4-1.5 1.5-1.5l6.8.3h80.2c1.1 0 1.5.2 1.5 1.4l.2 61.8.5 25.2c0 .7.1 1.3-.5 1.7z\" fill=\"#cbcbcb\"/><path d=\"M45.1 90.1H1.4c-1.1 0-1.5-.3-1.5-1.4L0 1.5C0 .3.3 0 1.5 0h87.3c1.2 0 1.4.4 1.4 1.5v87.1c0 1.2-.3 1.5-1.5 1.5H45.1zM138.8 0h43.5c1.1 0 1.5.3 1.5 1.4v87.2c0 1.2-.3 1.4-1.5 1.4H95.1c-1.2 0-1.5-.3-1.5-1.5V1.4C93.6.2 94 0 95.1 0h43.7z\" fill=\"#1565c0\"/><path d=\"M374.5 45.1V1.6c0-1.6 0-1.6 1.6-1.6h87.1c1.6 0 1.6 0 1.6 1.6v86.8c0 1.7 0 1.7-1.7 1.7h-86.9c-1.6 0-1.6 0-1.6-1.5l-.1-43.5z\" fill=\"#cbcbcb\"/><path d=\"M277.3 45.1v43.5c0 1.5 0 1.5-1.6 1.5h-86.9c-1.5 0-1.5 0-1.5-1.6V1.6c0-1.2.2-1.6 1.5-1.5H276c1.2 0 1.4.4 1.4 1.5l-.1 43.5z\" fill=\"#1565c0\"/><path d=\"M370.9 45.2v43.2c0 1.7 0 1.7-1.6 1.7h-86.8c-1.6 0-1.6 0-1.6-1.6v-87c0-1.5 0-1.5 1.6-1.5h86.8c1.6 0 1.6 0 1.6 1.6v43.6z\" fill=\"#cbcbcb\"/></svg>";
1568
+
1569
+ var four_one = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 558.2 183.6\" xmlns:v=\"https://vecta.io/nano\"><path d=\"M558.2 0v90.1h-88.3c-1.9 0-1.9 0-1.9-1.9V1.8c0-1.8 0-1.8 1.8-1.8h88.4zm-468 183.5H0V95.1c0-1.7 0-1.7 1.7-1.7h86.7c1.8 0 1.8 0 1.8 1.8v88.3zm93.6 0H93.6V95.3c0-1.9 0-1.9 1.9-1.9H182c1.8 0 1.8 0 1.8 1.8v88.3zm280.9 0h-90.2V95.1c0-1.7 0-1.7 1.6-1.7H463c1.6 0 1.6 0 1.6 1.7v64.1l.1 24.3zm93.5-90v89c0 .9-.2 1.1-1.1 1.1H468V95.2c0-1.7 0-1.7 1.7-1.7h88.5zm-280.9 90h-90V94.8c0-.9.1-1.5 1.2-1.5H276c.9 0 1.2.3 1.2 1.2l.1 89zm93.6 0h-90V95.1c0-1.7 0-1.7 1.7-1.7h86.5c1.8 0 1.8 0 1.8 1.8v88.3z\" fill=\"#cbcbcb\"/><path d=\"M0 45.1V1.5C0 .3.3 0 1.4 0h87.3c1.2 0 1.5.3 1.4 1.5v87.1c0 1.2-.3 1.5-1.5 1.5H1.4c-1.3 0-1.5-.4-1.5-1.6L0 45.1zm93.6-.2V1.4C93.6.3 93.9 0 95 0h87.3c1.2 0 1.4.3 1.4 1.5v87.2c0 1.2-.4 1.4-1.5 1.4H95c-1.2 0-1.5-.4-1.5-1.5l.1-43.7z\" fill=\"#1565c0\"/><path d=\"M374.5 45.1V1.6c0-1.6 0-1.6 1.6-1.6h87.1c1.5 0 1.5 0 1.5 1.6v86.7c0 1.8 0 1.8-1.8 1.8h-86.7c-1.7 0-1.7 0-1.7-1.7V45.1z\" fill=\"#cbcbcb\"/><path d=\"M277.3 45.1v43.4c0 1.6 0 1.6-1.6 1.6h-86.8c-1.6 0-1.6 0-1.6-1.6V1.7c0-1.6 0-1.6 1.5-1.6h87c1.5 0 1.6 0 1.6 1.5l-.1 43.5zm3.6-.2V1.4c0-1.1.3-1.5 1.4-1.5h87.2c1.2 0 1.5.3 1.5 1.5v87.2c0 1.1-.3 1.4-1.4 1.4h-87.3c-1.1 0-1.4-.4-1.4-1.4V44.9z\" fill=\"#1565c0\"/></svg>";
1570
+
1571
+ var four_two = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 558.2 183.6\" xmlns:v=\"https://vecta.io/nano\"><path d=\"M558.2 0v90.1h-88.3c-1.9 0-1.9 0-1.9-1.9V1.8c0-1.8 0-1.8 1.8-1.8h88.4z\" fill=\"#cbcbcb\"/><path d=\"M90.2 183.5H0V95.2c0-1.9-.2-1.8 1.7-1.8h86.7c1.7 0 1.7 0 1.7 1.8v86.6c.1.6.1 1.2.1 1.7zm93.6 0H93.6V95.2c0-1.8 0-1.8 1.7-1.8H182c1.9 0 1.7-.2 1.7 1.8l.1 88.3z\" fill=\"#1565c0\"/><path d=\"M464.6 183.5h-90.2V95.1c0-1.7 0-1.7 1.6-1.7h86.9c1.6 0 1.6 0 1.6 1.7v66.5l.1 21.9zm93.6-90v89c0 .9-.2 1.1-1.1 1.1H468V95.4c0-1.8 0-1.8 1.8-1.8h75.9c4.2-.1 8.3-.1 12.5-.1z\" fill=\"#cbcbcb\"/><path d=\"M277.3 183.5h-90c0-.5-.1-1-.1-1.4V95.2c0-1.7 0-1.7 1.7-1.7h86.7c1.7 0 1.7 0 1.7 1.7v88.3zm93.6 0h-90V95c0-1.6 0-1.6 1.6-1.6h86.8c1.7 0 1.7 0 1.7 1.7V182c-.1.6-.1 1.1-.1 1.5zM138.7 90.1H95.3c-1.6 0-1.6 0-1.6-1.6v-87c0-1.3.4-1.5 1.6-1.5h87.1c1.6 0 1.6 0 1.6 1.5v87c0 1.5 0 1.5-1.6 1.5l-43.7.1z\" fill=\"#1565c0\"/><path d=\"M374.5 45V1.6c0-1.6 0-1.6 1.6-1.6h87.1c1.6 0 1.6 0 1.6 1.6v86.8c0 1.7 0 1.7-1.7 1.7h-86.9c-1.6 0-1.6 0-1.6-1.5l-.1-43.6z\" fill=\"#cbcbcb\"/><path d=\"M277.3 45v43.6c0 1.1-.3 1.5-1.5 1.5h-87.2c-1.2 0-1.4-.4-1.4-1.5V1.5c0-1.2.3-1.5 1.5-1.5h87.1c1.3 0 1.5.4 1.5 1.5V45zm3.6.1V1.5c0-1.2.3-1.5 1.5-1.5h87.2c1.2 0 1.4.3 1.4 1.5v87.1c0 1.2-.3 1.5-1.5 1.5h-87.1c-1.3 0-1.5-.4-1.5-1.6V45.1zm-235.6 45H1.8c-1.6 0-1.6 0-1.6-1.6V1.7C.2.1.2.1 1.8.1h87c1.6 0 1.6 0 1.6 1.6v86.8c0 1.6 0 1.6-1.7 1.6H45.3z\" fill=\"#1565c0\"/></svg>";
1572
+
1573
+ var five_one = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 558.2 183.6\" xmlns:v=\"https://vecta.io/nano\"><path d=\"M183.8 183.5H93.6V95.4c0-1.8 0-1.8 1.8-1.8H182c1.8 0 1.8 0 1.8 1.8v88.1zm280.9 0h-90.2V95.2c0-1.6 0-1.6 1.5-1.6h87.1c1.5 0 1.6 0 1.6 1.6v88.3zM558.2 0v89.8H470c-1.7 0-1.7 0-1.7-1.8V1.7c0-1.8 0-1.8 1.7-1.8l88.2.1zM90 183.5H0V95.4c0-1.7 0-1.7 1.8-1.7h86.5c1.8 0 1.8 0 1.8 1.7v86.8c-.1.5-.1.9-.1 1.3zm187.3 0h-90V94.8c0-1 .5-1.2 1.3-1.2H276c1 0 1.3.3 1.3 1.3v88.6zm93.6 0h-90V95.4c0-1.7 0-1.7 1.8-1.7h86.5c1.8 0 1.8 0 1.8 1.7v86.8c-.1.5-.1.9-.1 1.3zm187.3-89.8v88.8c0 .9-.2 1.1-1.1 1.1h-88.9V95.5c0-1.8 0-1.8 1.8-1.8h88.2z\" fill=\"#cbcbcb\"/><path d=\"M0 44.9V1.5C0 .3.3 0 1.4 0h87.3c1.2 0 1.5.3 1.5 1.5v87.1c0 1.2-.3 1.6-1.5 1.6H1.5c-1.3 0-1.5-.4-1.5-1.6V44.9zm183.8.3v43.5c0 1.1-.2 1.4-1.4 1.4H95c-1.1 0-1.4-.4-1.4-1.4V1.4c0-1.1.3-1.3 1.3-1.3h87.6c1.1 0 1.3.3 1.3 1.3v43.8zm93.5 0v43.4c0 1.2-.2 1.5-1.5 1.5h-87.1c-1.2 0-1.5-.3-1.5-1.5v-87c0-1.6 0-1.6 1.6-1.6h87c1.5 0 1.5 0 1.5 1.6v43.6zm3.6-.3V1.4c0-1.1.3-1.5 1.4-1.5h87.2c1.2 0 1.5.3 1.5 1.5v87.2c0 1.1-.3 1.4-1.4 1.4h-87.3c-1.1 0-1.4-.4-1.4-1.4V44.9zm183.4.3v43.1c0 1.6 0 1.6-1.6 1.6h-86.3c-1.2 0-1.6-.3-1.6-1.5V1.9c0-1.1.3-1.5 1.5-1.5h86.6c1.2 0 1.4.4 1.4 1.5v43.3z\" fill=\"#1565c0\"/></svg>";
1574
+
1575
+ var five_two = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 558.2 183.6\" xmlns:v=\"https://vecta.io/nano\"><path d=\"M558.2 0v90.1h-88.3c-1.9 0-1.9 0-1.9-1.9V1.8c0-1.8 0-1.8 1.8-1.8h88.4zm0 93.5v89c0 .9-.2 1.1-1.1 1.1H468V95.4c0-1.8 0-1.8 1.8-1.8h75.9c4.2-.1 8.4-.1 12.5-.1z\" fill=\"#cbcbcb\"/><g fill=\"#1565c0\"><path d=\"M183.8 183.5H93.6V95.1c0-1.6 0-1.7 1.6-1.7H182c1.7 0 1.7 0 1.7 1.8l.1 88.3zm280.9 0h-90.2V95.2c0-1.8 0-1.8 1.7-1.8h86.7c1.7 0 1.7 0 1.7 1.8v86.6c0 .6.1 1.2.1 1.7zm-374.7 0H0V94.9c0-1.2.3-1.5 1.5-1.5h87c1.6 0 1.6 0 1.6 1.6v87.1c0 .5-.1 1-.1 1.4zm187.3 0h-90c0-.4-.1-.9-.1-1.3V95.3c0-1.7 0-1.7 1.7-1.7h86.7c1.7 0 1.7 0 1.7 1.7v88.2zm93.6 0h-90V95.4c0-1.8 0-1.8 1.8-1.8h86.5c1.8 0 1.8 0 1.8 1.8v86.7c-.1.5-.1 1-.1 1.4zM138.8 90.1H95.1c-1.2 0-1.6-.3-1.6-1.5V1.4C93.6.3 93.9 0 95 0h87.4c1.1 0 1.4.4 1.4 1.4v87.2c0 1.1-.3 1.5-1.5 1.5h-43.5zm280.6 0H376c-1.6 0-1.6 0-1.6-1.6v-87c0-1.2.2-1.5 1.5-1.5h87.2c1.2 0 1.5.3 1.5 1.5v87c0 1.6 0 1.6-1.7 1.6h-43.5zM.2 45.1V1.7C.2.1.2.1 1.9.1h86.8c1.6 0 1.6 0 1.6 1.7v86.7c0 1.6 0 1.6-1.6 1.6H1.9c-1.6 0-1.6 0-1.6-1.7L.2 45.1z\"/><path d=\"M277.3 45.1v43.4c0 1.6 0 1.6-1.6 1.6h-86.9c-1.2 0-1.6-.3-1.6-1.5V1.5c0-1.2.4-1.4 1.5-1.4h87.2c1.2 0 1.4.4 1.4 1.5v43.5zM325.8 90h-43.3c-1.6 0-1.6 0-1.6-1.5V1.6c0-1.2.3-1.5 1.5-1.5h87.1c1.2 0 1.5.3 1.5 1.5v86.8c0 1.6 0 1.6-1.6 1.6h-43.6z\"/></g></svg>";
1576
+
1577
+ var six_one = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 558.2 183.6\" xmlns:v=\"https://vecta.io/nano\"><path d=\"M558.2 0v90.1h-88.5c-1.6 0-1.6 0-1.6-1.6V1.7c0-1.6 0-1.6 1.6-1.6l88.5-.1z\" fill=\"#1565c0\"/><path d=\"M90.2 183.5H0V95.1c0-1.7 0-1.7 1.7-1.7h86.7c1.8 0 1.8 0 1.8 1.8v88.3zm93.6 0H93.6V95.3c0-1.9 0-1.9 1.9-1.9H182c1.8 0 1.8 0 1.8 1.8v88.3zm280.9 0h-90.2V95.1c0-1.7 0-1.7 1.6-1.7H463c1.6 0 1.6 0 1.6 1.7v64.1l.1 24.3zm93.5-90v89c0 .9-.2 1.1-1.1 1.1H468V95.2c0-1.7 0-1.7 1.7-1.7h88.5zm-280.9 90h-90V94.8c0-.9.1-1.5 1.2-1.5H276c.9 0 1.2.3 1.2 1.2l.1 89zm93.6 0h-90V95.1c0-1.7 0-1.7 1.7-1.7h86.5c1.8 0 1.8 0 1.8 1.8v88.3z\" fill=\"#cbcbcb\"/><path d=\"M0 45.1V1.5C0 .3.3 0 1.4 0h87.3c1.2 0 1.5.3 1.4 1.5v87.1c0 1.2-.3 1.5-1.5 1.5H1.4c-1.3 0-1.5-.4-1.5-1.6L0 45.1zm93.6-.1V1.5C93.6.3 93.9 0 95 0h87.3c1.2 0 1.4.3 1.4 1.5v87.2c0 1.2-.4 1.4-1.5 1.4H95c-1.2 0-1.5-.4-1.5-1.5l.1-43.6zM419.7 0h43.4c1.2 0 1.6.2 1.6 1.5v87.1c0 1.2-.3 1.5-1.5 1.5H376c-1.1 0-1.5-.3-1.5-1.4V1.5c0-1.2.3-1.4 1.5-1.4l43.7-.1zM277.3 45.1v43.3c0 1.6 0 1.6-1.6 1.6h-86.8c-1.7 0-1.7 0-1.7-1.6V1.5c0-1.2.3-1.5 1.5-1.5h87.2c1.2 0 1.4.4 1.4 1.5v43.6zm3.6-.2V1.4c0-1.1.3-1.5 1.4-1.5h87.2c1.3 0 1.5.4 1.5 1.6v86.9c0 1.6 0 1.6-1.5 1.6h-87c-1.1 0-1.5-.3-1.5-1.4l-.1-43.7z\" fill=\"#1565c0\"/></svg>";
1578
+
1579
+ var six_two = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 652.1 183.8\" fill=\"#1565c0\" xmlns:v=\"https://vecta.io/nano\"><path d=\"M652.1.3v90.1h-88.5c-1.6 0-1.6 0-1.6-1.6V2c0-1.6 0-1.6 1.6-1.6l88.5-.1zM90.5 183.8H.3V95.4c0-1.6 0-1.6 1.7-1.7h86.7c1.7 0 1.7 0 1.7 1.8v86.6c0 .6 0 1.2.1 1.7zm93.5 0H93.8V95.4c0-1.6 0-1.6 1.6-1.6h86.9c1.6 0 1.6 0 1.6 1.6v80.2l.1 8.2zm374.5 0h-90.2V95.5c0-1.9-.2-1.8 1.7-1.8h86.7c1.7 0 1.7 0 1.7 1.8v86.6c.1.6.1 1.2.1 1.7zm93.6-90.1v89c0 .9-.2 1.1-1.1 1.1h-89.1c0-.6.1-1.1.1-1.7V95.5c0-1.8 0-1.8 1.7-1.8h86.7c.5.1 1.1.1 1.7 0zm-374.5 90.1h-90c0-.5-.1-1-.1-1.4v-87c0-1.6 0-1.6 1.6-1.6h87.1c1 0 1.4.2 1.4 1.3v88.7zm93.5 0h-90V95.6c0-1.8 0-1.8 1.7-1.8h86.6c1.7 0 1.7 0 1.7 1.8v86.8c.1.5.1.9 0 1.4zm93.6 0h-90V95c0-1.3.6-1.3 1.5-1.3H463c1.7 0 1.7 0 1.7 1.8v86.7c.1.6 0 1.1 0 1.6z\"/><path d=\"M.3 45.3V1.8C.3.6.5.3 1.8.3H89c1.2 0 1.5.3 1.5 1.5v86.9c0 1.6 0 1.6-1.6 1.6H1.8c-1.5 0-1.5 0-1.5-1.6V45.3zm93.6-.1V1.8c0-1.6 0-1.6 1.5-1.6h87.1c1.5 0 1.5 0 1.5 1.6v86.9c0 1.2-.2 1.6-1.5 1.6H95.3c-1.3 0-1.5-.4-1.5-1.6l.1-43.5zm464.6.2v43.4c0 1.6 0 1.6-1.6 1.6h-87.1c-1.2 0-1.6-.2-1.6-1.5V1.8c0-1.2.3-1.5 1.5-1.5h87.2c1.2 0 1.5.4 1.5 1.5l.1 43.6zm-280.9-.1v43.5c0 1.2-.2 1.6-1.5 1.5H189c-1.2 0-1.5-.3-1.5-1.5v-87c0-1.6 0-1.6 1.6-1.6h87c1.5 0 1.5 0 1.5 1.6v43.5zm93.6-.1v43.5c0 1.6 0 1.6-1.6 1.6h-86.8c-1.6 0-1.6 0-1.6-1.6V1.9c0-1.6 0-1.6 1.5-1.6h87c1.6 0 1.6 0 1.6 1.6l-.1 43.3zm3.5.1V1.8c0-1.6 0-1.6 1.5-1.6h87c1.6 0 1.6 0 1.6 1.6v87c0 1.2-.3 1.5-1.5 1.5h-87.1c-1.2 0-1.5-.4-1.5-1.5V45.3z\"/></svg>";
1580
+
1581
+ var GridImages = {
1582
+ '1x1': one_one,
1583
+ '2x1': two_one,
1584
+ '3x1': three_one,
1585
+ '3x2': three_two,
1586
+ '4x1': four_one,
1587
+ '4x2': four_two,
1588
+ '5x1': five_one,
1589
+ '5x2': five_two,
1590
+ '6x1': six_one,
1591
+ '6x2': six_two,
1592
+ };
1593
+
1594
+ var Settings = {
1595
+ render: function(){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',[(_vm.dialogsVisibility.frames)?_c('GlobalEvents',{on:{"keydown":[function($event){if(!$event.type.indexOf('key')&&$event.keyCode!==37){ return null; }return _vm.prevFormat.apply(null, arguments)},function($event){if(!$event.type.indexOf('key')&&$event.keyCode!==39){ return null; }return _vm.nextFormat.apply(null, arguments)}]}}):_vm._e(),_vm._v(" "),_c('dialog',{ref:"frames"},[_c('div',{staticClass:"visualization-row",staticStyle:{"padding":"5px","font-weight":"bold","background-color":"var(--visualization-primary)","border-color":"var(--visualization-primary)","height":"40px","color":"white","display":"flex","justify-content":"center","padding-top":"10px"}},[_vm._v("\n "+_vm._s(_vm.$t('infoBar.gridForm'))+"\n ")]),_vm._v(" "),_c('div',{staticClass:"visualization-row",staticStyle:{"justify-content":"center"}},_vm._l((_vm.items),function(item,index){return _c('div',{key:index,staticClass:"visualization-col",staticStyle:{"min-width":"200px","max-width":"200px"}},[_c('img',{style:(_vm.framesValue !== item.value ? 'filter: grayscale(1)' : ''),attrs:{"src":item.image,"width":"100%"},on:{"click":function () { return (_vm.framesValue = item.value); }}})])}),0),_vm._v(" "),_c('div',{staticClass:"visualization-divider"}),_vm._v(" "),_c('div',{staticClass:"visualization-row",staticStyle:{"display":"flex","justify-content":"center","margin-top":"10px","margin-bottom":"10px"}},[_c('button',{staticStyle:{"border-radius":"4px","height":"35px","width":"70px","background-color":"var(--visualization-primary)","border-color":"var(--visualization-primary)","color":"white"},on:{"click":function($event){return _vm.$emit('close', 'frames')}}},[_vm._v("\n Ok\n ")])])]),_vm._v(" "),_c('dialog',{ref:"secondsPerFrame"},[_c('div',{staticClass:"visualization-row",staticStyle:{"padding":"5px","font-weight":"bold","background-color":"var(--visualization-primary)","border-color":"var(--visualization-primary)","height":"40px","color":"white","display":"flex","justify-content":"center","padding-top":"10px"}},[_vm._v("\n "+_vm._s(_vm.$t('infoBar.secondImage'))+"\n ")]),_vm._v(" "),_c('div',{staticClass:"visualization-row",staticStyle:{"margin":"25px","height":"20px"}},[_c('input',{directives:[{name:"model",rawName:"v-model",value:(_vm.secondsPerFrameValue),expression:"secondsPerFrameValue"}],ref:"secondsPerFrameInput",staticStyle:{"height":"30px","width":"300px"},attrs:{"type":"range","step":"1","max":"5","min":"1"},domProps:{"value":(_vm.secondsPerFrameValue)},on:{"__r":function($event){_vm.secondsPerFrameValue=$event.target.value;}}}),_vm._v(" "),_c('span',{staticStyle:{"padding-left":"20px","font-size":"16px"}},[_vm._v("\n "+_vm._s(_vm.secondsPerFrame + ' s'))])]),_vm._v(" "),_c('div',{staticClass:"visualization-divider",staticStyle:{"margin":"10px"}}),_vm._v(" "),_c('div',{staticClass:"visualization-row",staticStyle:{"display":"flex","justify-content":"center","margin-top":"10px"}},[_c('button',{staticStyle:{"border-radius":"4px","height":"35px","width":"70px","background-color":"var(--visualization-primary)","border-color":"var(--visualization-primary)","color":"white","margin-bottom":"8px"},on:{"click":function($event){return _vm.$emit('close', 'secondsPerFrame')}}},[_vm._v("\n Ok\n ")])])]),_vm._v(" "),_c('dialog',{ref:"goTo"},[_c('div',{staticStyle:{"padding":"5px","font-weight":"bold","background-color":"var(--visualization-primary)","border-color":"var(--visualization-primary)","height":"35px","color":"white","display":"flex","justify-content":"center","padding-top":"8px"}},[_vm._v("\n "+_vm._s(_vm.$t('infoBar.goTo'))+"\n ")]),_vm._v(" "),_c('div',{staticClass:"visualization-row",staticStyle:{"margin":"25px","height":"20px"}},[_c('input',{directives:[{name:"model",rawName:"v-model",value:(_vm.goToValue),expression:"goToValue"},{name:"mask",rawName:"v-mask",value:('##:##:##'),expression:"'##:##:##'"}],staticStyle:{"height":"30px","width":"300px","border":"0.1px solid #c2c9d6","border-radius":"3px","padding":"5px"},attrs:{"type":"text","placeholder":"hh:mm:ss"},domProps:{"value":(_vm.goToValue)},on:{"input":function($event){if($event.target.composing){ return; }_vm.goToValue=$event.target.value;}}})]),_vm._v(" "),_c('div',{staticClass:"visualization-divider",staticStyle:{"margin-top":"40px"}}),_vm._v(" "),_c('div',{staticClass:"visualization-row",staticStyle:{"display":"flex","justify-content":"center","margin-top":"10px","margin-bottom":"10px"}},[_c('button',{staticStyle:{"border-radius":"4px","height":"35px","width":"70px","background-color":"var(--visualization-primary)","border-color":"var(--visualization-primary)","color":"white"},on:{"click":function () {
1596
+ _vm.$emit('close', 'goTo');
1597
+ _vm.$emit('change-go-to', _vm.goToValue);
1598
+ _vm.goToValue = '';
1599
+ }}},[_vm._v("\n Ok\n ")])])]),_vm._v(" "),_c('GlobalEvents',{on:{"keydown":[function($event){if(!$event.type.indexOf('key')&&$event.keyCode!==107){ return null; }return _vm.changePlaybackRate(1)},function($event){if(!$event.type.indexOf('key')&&$event.keyCode!==109){ return null; }return _vm.changePlaybackRate(-1)}]}}),_vm._v(" "),_c('dialog',{ref:"playbackRate"},[_c('div',{staticClass:"visualization-row",staticStyle:{"padding":"5px","font-weight":"bold","background-color":"var(--visualization-primary)","border-color":"var(--visualization-primary)","height":"35px","color":"white","display":"flex","justify-content":"center","padding-top":"8px"}},[_vm._v("\n "+_vm._s(_vm.$t('infoBar.playbackSpeed'))+"\n ")]),_vm._v(" "),_c('div',{staticClass:"visualization-row",staticStyle:{"margin":"25px","height":"20px","width":"380px"}},[_c('input',{directives:[{name:"model",rawName:"v-model",value:(_vm.playbackRateValue),expression:"playbackRateValue"}],ref:"playbackRateInput",staticStyle:{"height":"30px","width":"300px"},attrs:{"type":"range","step":"0.25","max":"3","min":"1"},domProps:{"value":(_vm.playbackRateValue)},on:{"__r":function($event){_vm.playbackRateValue=$event.target.value;}}}),_vm._v(" "),_c('span',{staticStyle:{"padding-left":"20px","padding-right":"20px","font-size":"16px"}},[_vm._v(_vm._s(_vm.playbackRate + 'x'))])]),_vm._v(" "),_c('div',{staticClass:"visualization-divider",staticStyle:{"margin-top":"40px"}}),_vm._v(" "),_c('div',{staticClass:"visualization-row",staticStyle:{"display":"flex","justify-content":"center","margin-top":"10px","margin-bottom":"10px"}},[_c('button',{staticStyle:{"border-radius":"4px","height":"35px","width":"70px","background-color":"var(--visualization-primary)","border-color":"var(--visualization-primary)","color":"white"},on:{"click":function($event){return _vm.$emit('close', 'playbackRate')}}},[_vm._v("\n Ok\n ")])])])],1)},
1600
+ staticRenderFns: [],
1601
+ props: {
1602
+ dialogsVisibility: {
1603
+ type: Object,
1604
+ required: false,
1605
+ },
1606
+ playbackRate: {
1607
+ type: Number,
1608
+ required: true,
1609
+ },
1610
+ secondsPerFrame: {
1611
+ type: Number,
1612
+ required: true,
1613
+ },
1614
+ framesPerRow: {
1615
+ type: Number,
1616
+ required: true,
1617
+ },
1618
+ numberOfRows: {
1619
+ type: Number,
1620
+ required: true,
1621
+ },
1622
+ },
1623
+ data() {
1624
+ return {
1625
+ openBlocksDialog: false,
1626
+ time: '',
1627
+ rangeBlocks: {
1628
+ ini: null,
1629
+ end: null,
1630
+ date: null,
1631
+ },
1632
+ items: [
1633
+ { text: '2x1', value: 1, image: GridImages['2x1'] },
1634
+ { text: '3x1', value: 2, image: GridImages['3x1'] },
1635
+ { text: '3x2', value: 3, image: GridImages['3x2'] },
1636
+ { text: '4x1', value: 4, image: GridImages['4x1'] },
1637
+ { text: '4x2', value: 5, image: GridImages['4x2'] },
1638
+ { text: '5x1', value: 6, image: GridImages['5x1'] },
1639
+ { text: '5x2', value: 7, image: GridImages['5x2'] },
1640
+ { text: '6x1', value: 8, image: GridImages['6x1'] },
1641
+ { text: '6x2', value: 9, image: GridImages['6x2'] },
1642
+ ],
1643
+
1644
+ // NEW
1645
+ goToValue: '',
1646
+ }
1647
+ },
1648
+ mounted() {
1649
+ this.toogleDialogs();
1650
+ },
1651
+ computed: {
1652
+ secondsPerFrameValue: {
1653
+ get() {
1654
+ return this.secondsPerFrame
1655
+ },
1656
+ set(val) {
1657
+ this.$emit('change-seconds-per-frame', parseInt(val));
1658
+ },
1659
+ },
1660
+ playbackRateValue: {
1661
+ get() {
1662
+ return this.playbackRate
1663
+ },
1664
+ set(val) {
1665
+ this.$emit('change-playback-rate', parseFloat(val));
1666
+ },
1667
+ },
1668
+ framesValue: {
1669
+ get() {
1670
+ return this.items.find(
1671
+ (item) => item.text === `${this.framesPerRow}x${this.numberOfRows}`
1672
+ ).value
1673
+ },
1674
+ set(value) {
1675
+ this.$emit('set-frames-selection', value);
1676
+ },
1677
+ },
1678
+ timeRules() {
1679
+ return [
1680
+ (time) =>
1681
+ (time >= '02:30:00' && time <= '26:29:59') ||
1682
+ this.$i18n.t('form.mustBeBetween'),
1683
+ ]
1684
+ },
1685
+ },
1686
+ methods: {
1687
+ toogleDialogs() {
1688
+ for (const dialog of Object.values(this.$refs)) {
1689
+ dialog.close?.();
1690
+ }
1691
+
1692
+ const openDialog = Object.keys(this.dialogsVisibility).find(
1693
+ (key) => this.dialogsVisibility[key]
1694
+ );
1695
+
1696
+ if (openDialog) {
1697
+ this.$refs[openDialog].showModal();
1698
+ }
1699
+ },
1700
+ prevFormat() {
1701
+ if (this.items.find((format) => format.value === this.framesValue - 1)) {
1702
+ this.framesValue--;
1703
+ }
1704
+ },
1705
+ nextFormat() {
1706
+ if (this.items.find((format) => format.value === this.framesValue + 1)) {
1707
+ this.framesValue++;
1708
+ }
1709
+ },
1710
+ changePlaybackRate(direction = 1) {
1711
+ if (direction === 1) {
1712
+ this.$refs.playbackRateInput.stepUp();
1713
+ } else if (direction === -1) {
1714
+ this.$refs.playbackRateInput.stepDown();
1715
+ }
1716
+ this.playbackRateValue = this.$refs.playbackRateInput.value;
1717
+ },
1718
+ closeBlocksDialog() {
1719
+ Object.entries(this.rangeBlocks).forEach(([key, value]) => {
1720
+ if (!value || key == 'date') return
1721
+ var res = value.replace(/\D/g, '');
1722
+ if (res.length < 6) {
1723
+ for (let i = res.length; i < 6; i++) {
1724
+ res += '0';
1725
+ }
1726
+ }
1727
+ res.match(/.{1,2}/g);
1728
+ let a = res.substring(0, 2);
1729
+ let b = res.substring(2, 4);
1730
+ let c = res.substring(4, 6);
1731
+ this.rangeBlocks[key] = a + ':' + b + ':' + c;
1732
+ });
1733
+
1734
+ this.openBlocksDialog = false;
1735
+ this.$emit('goToBlockInterval', this.rangeBlocks);
1736
+ },
1737
+ },
1738
+ watch: {
1739
+ dialogsVisibility: {
1740
+ handler() {
1741
+ this.toogleDialogs();
1742
+ },
1743
+ deep: true,
1744
+ },
1745
+ },
1746
+ };
1747
+
1748
+ const Positions = Object.freeze({
1749
+ previous: 0,
1750
+ current: 1,
1751
+ next: 2,
1752
+ });
1753
+
1754
+ var Visualization = {
1755
+ render: function(){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"visualization-row",attrs:{"id":"visualization-container"},on:{"click":_vm.framesClicked}},[(_vm.active && _vm.canInsertTime && _vm.settingsClosed)?_c('GlobalEvents',{on:{"keydown":[function($event){if(!$event.type.indexOf('key')&&$event.keyCode!==45){ return null; }return _vm.insertTime.apply(null, arguments)},function($event){if(!$event.type.indexOf('key')&&$event.keyCode!==46){ return null; }return _vm.insertTime.apply(null, arguments)}]}}):_vm._e(),_vm._v(" "),(_vm.active && _vm.settingsClosed)?_c('GlobalEvents',{on:{"keydown":[function($event){if(!$event.type.indexOf('key')&&_vm._k($event.keyCode,"left",37,$event.key,["Left","ArrowLeft"])){ return null; }if('button' in $event && $event.button !== 0){ return null; }$event.preventDefault();return _vm.arrowLeft.apply(null, arguments)},function($event){if(!$event.type.indexOf('key')&&_vm._k($event.keyCode,"right",39,$event.key,["Right","ArrowRight"])){ return null; }if('button' in $event && $event.button !== 2){ return null; }$event.preventDefault();return _vm.arrowRight.apply(null, arguments)},function($event){if(!$event.type.indexOf('key')&&_vm._k($event.keyCode,"page-down",undefined,$event.key,undefined)){ return null; }if(!$event.shiftKey){ return null; }$event.preventDefault();return _vm.nextLoopActivate.apply(null, arguments)},function($event){if(!$event.type.indexOf('key')&&_vm._k($event.keyCode,"page-down",undefined,$event.key,undefined)){ return null; }$event.preventDefault();return _vm.next.apply(null, arguments)},function($event){if(!$event.type.indexOf('key')&&_vm._k($event.keyCode,"page-up",undefined,$event.key,undefined)){ return null; }$event.preventDefault();return _vm.prev.apply(null, arguments)},function($event){if(!$event.type.indexOf('key')&&_vm._k($event.keyCode,"page-up",undefined,$event.key,undefined)){ return null; }if(!$event.shiftKey){ return null; }$event.preventDefault();return _vm.prevLoopActivate.apply(null, arguments)},function($event){if(!$event.type.indexOf('key')&&$event.keyCode!==83){ return null; }$event.preventDefault();return _vm.setHourIni.apply(null, arguments)},function($event){if(!$event.type.indexOf('key')&&$event.keyCode!==69){ return null; }$event.preventDefault();return _vm.setHourEnd.apply(null, arguments)},function($event){if(!$event.type.indexOf('key')&&$event.keyCode!==36){ return null; }$event.preventDefault();return _vm.goToFirstFrame.apply(null, arguments)},function($event){if(!$event.type.indexOf('key')&&$event.keyCode!==35){ return null; }$event.preventDefault();return _vm.goToLastFrame.apply(null, arguments)},function($event){if(!$event.type.indexOf('key')&&$event.keyCode!==71){ return null; }$event.preventDefault();_vm.dialogs.goTo = true;},function($event){if(!$event.type.indexOf('key')&&$event.keyCode!==73){ return null; }$event.preventDefault();_vm.dialogs.secondsPerFrame = true;},function($event){if(!$event.type.indexOf('key')&&$event.keyCode!==76){ return null; }$event.preventDefault();_vm.dialogs.frames = true;},function($event){if(!$event.type.indexOf('key')&&$event.keyCode!==49&&$event.keyCode!==97){ return null; }return (function () { return (_vm.secondsPerFrame = 1); }).apply(null, arguments)},function($event){if(!$event.type.indexOf('key')&&$event.keyCode!==50&&$event.keyCode!==98){ return null; }return (function () { return (_vm.secondsPerFrame = 2); }).apply(null, arguments)},function($event){if(!$event.type.indexOf('key')&&$event.keyCode!==51&&$event.keyCode!==99){ return null; }return (function () { return (_vm.secondsPerFrame = 3); }).apply(null, arguments)},function($event){if(!$event.type.indexOf('key')&&$event.keyCode!==52&&$event.keyCode!==100){ return null; }return (function () { return (_vm.secondsPerFrame = 4); }).apply(null, arguments)},function($event){if(!$event.type.indexOf('key')&&$event.keyCode!==53&&$event.keyCode!==101){ return null; }return (function () { return (_vm.secondsPerFrame = 5); }).apply(null, arguments)}]}}):_vm._e(),_vm._v(" "),(_vm.prevLoop || _vm.nextLoop)?_c('GlobalEvents',{on:{"keydown":_vm.breakLoop,"click":_vm.breakLoop}}):_vm._e(),_vm._v(" "),(_vm.active)?_c('settings',{attrs:{"dialogs-visibility":_vm.dialogs,"playback-rate":_vm.playbackRate,"seconds-per-frame":_vm.secondsPerFrame,"frames-per-row":_vm.framesPerRow,"number-of-rows":_vm.numberOfRows},on:{"change-playback-rate":function (value) { return (_vm.playbackRate = value); },"change-go-to":_vm.changeHour,"change-seconds-per-frame":function (value) { return (_vm.secondsPerFrame = value); },"set-frames-selection":_vm.setFrameSelection,"close":function (dialog) { return (_vm.dialogs[dialog] = false); }}}):_vm._e(),_vm._v(" "),_c('div',{class:{ 'visualization-card': true, 'active-tab': _vm.active },staticStyle:{"width":"100%","padding":"0"}},[_c('command-bar',{directives:[{name:"show",rawName:"v-show",value:(_vm.commandBarShow),expression:"commandBarShow"}],attrs:{"video-playing":_vm.videoPlaying,"video-paused":_vm.paused,"insert-time":_vm.canInsertTime,"hour-ini-selected":!!_vm.hourIniSelected,"hour-end-selected":!!_vm.hourEndSelected},on:{"prev-loop-activate":_vm.prevLoopActivate,"next-loop-activate":_vm.nextLoopActivate,"prev":_vm.prev,"next":_vm.next,"go-to":function($event){_vm.dialogs.goTo = true;},"open-frame-selection":function($event){_vm.dialogs.frames = true;},"open-frames-per-second":function($event){_vm.dialogs.secondsPerFrame = true;},"open-blocks":_vm.openBlocks,"open-playback-rate":function($event){_vm.dialogs.playbackRate = true;},"play-or-pause":_vm.playOrPause,"stop-playing":_vm.stopPlayingBar,"set-hour-ini":_vm.setHourIni,"set-hour-end":_vm.setHourEnd,"insert-time":_vm.insertTime}}),_vm._v(" "),(_vm.videoProgressBar)?_c('video-progress',{directives:[{name:"show",rawName:"v-show",value:(_vm.videoPlaying),expression:"videoPlaying"}],attrs:{"video-time":_vm.videoTime}}):_vm._e(),_vm._v(" "),_c('info-bar',{attrs:{"playback-rate":_vm.playbackRate,"seconds-per-frame":_vm.secondsPerFrame,"commands-show":_vm.commandBarShow,"cache":_vm.useCache,"block-start-time":_vm.blockStartTime,"video-total-duration":_vm.videoSliderTotalDuration,"alternative-server":_vm.alternativeServer,"frames-per-row":_vm.framesPerRow,"number-of-rows":_vm.numberOfRows,"hour-ini":_vm.hourIniSelected,"hour-end":_vm.hourEndSelected},on:{"toogle-commands-visibility":function($event){_vm.commandBarShow = !_vm.commandBarShow;},"toogle-cache":function($event){_vm.useCache = !_vm.useCache;},"change-server":_vm.changeServerClick}}),_vm._v(" "),_vm._l((_vm.numberOfRows),function(rowNumber){return _c('div',{key:'row-' + rowNumber,staticClass:"visualization-row",staticStyle:{"padding":"12px"},attrs:{"id":'row-' + rowNumber}},[_vm._l((_vm.previousFrames),function(frame,frameNumber){return _c('div',{key:_vm.numberOfRows +
1756
+ '-' +
1757
+ _vm.framesPerRow +
1758
+ '-' +
1759
+ _vm.getIndex(rowNumber, frameNumber, _vm.Positions.previous),staticStyle:{"display":"none"}},[_c('span',{domProps:{"innerHTML":_vm._s(frame.img)}})])}),_vm._v(" "),_vm._l((_vm.nextFrames),function(frame,frameNumber){return _c('div',{key:_vm.numberOfRows +
1760
+ '-' +
1761
+ _vm.framesPerRow +
1762
+ '-' +
1763
+ _vm.getIndex(rowNumber, frameNumber, _vm.Positions.next),staticStyle:{"display":"none"}},[_c('span',{domProps:{"innerHTML":_vm._s(frame.img)}})])}),_vm._v(" "),_vm._l((_vm.frames.slice(
1764
+ _vm.framesPerRow * (rowNumber - 1),
1765
+ _vm.framesPerRow * rowNumber
1766
+ )),function(frame,frameNumber){return _c('div',{key:'row-' + rowNumber + '-frame-' + frameNumber,staticClass:"visualization-col",class:{ loaderImg: !!frame.img },attrs:{"id":("frame-" + (_vm.getIndex(rowNumber, frameNumber, _vm.Positions.current)))},on:{"click":function($event){frame.time
1767
+ ? _vm.selectFrame(
1768
+ _vm.getIndex(rowNumber, frameNumber, _vm.Positions.current),
1769
+ frame
1770
+ )
1771
+ : null;}}},[_c('span',{staticStyle:{"padding-left":"4px"},attrs:{"id":_vm.activeFrame ? 'aa' : 0}},[_c('b',[_vm._v("\n "+_vm._s(_vm.getAudienceTime(
1772
+ frame.time,
1773
+ rowNumber,
1774
+ frameNumber,
1775
+ _vm.Positions.current
1776
+ ))+"\n ")])]),_vm._v(" "),_c('frame',{ref:"frames",refInFor:true,staticStyle:{"margin":"0 auto"},attrs:{"frame":frame,"index":_vm.getIndex(rowNumber, frameNumber, _vm.Positions.current),"grid-settings":{ numberOfRows: _vm.numberOfRows, framesPerRow: _vm.framesPerRow },"initialTime":frame.time === _vm.hourIniSelected,"endTime":frame.time === _vm.hourEndSelected,"betweenTime":frame.time > _vm.hourIniSelected && frame.time < _vm.hourEndSelected,"active":_vm.getIndex(rowNumber, frameNumber, _vm.Positions.current) ===
1777
+ _vm.activeFrame,"activeTab":_vm.active,"videoUrl":_vm.fInterface ? _vm.fInterface.getVideoUrl(frame) : '',"playback-rate":_vm.playbackRate},on:{"startPlaying":_vm.startPlaying,"stopPlaying":_vm.stopPlaying,"playPauseStatus":_vm.changePlayPause,"updateSlider":_vm.updateSlider}})],1)})],2)})],2)],1)},
1778
+ staticRenderFns: [],
1779
+ name: 'visualization-container',
1780
+ props: {
1781
+ value: {
1782
+ type: Boolean,
1783
+ required: true,
1784
+ },
1785
+ date: {
1786
+ type: String,
1787
+ required: true,
1788
+ },
1789
+ channel: {
1790
+ type: Number,
1791
+ required: true,
1792
+ },
1793
+ startAudienceTime: {
1794
+ type: String,
1795
+ required: true,
1796
+ },
1797
+ videoProgressBar: {
1798
+ type: Boolean,
1799
+ default: false,
1800
+ },
1801
+ jumpOnInsert: {
1802
+ type: Boolean,
1803
+ default: false,
1804
+ },
1805
+ framesFormat: {
1806
+ type: [Number, String],
1807
+ default: 6,
1808
+ },
1809
+ maxSize: {
1810
+ type: Number,
1811
+ }
1812
+ },
1813
+ components: {
1814
+ Frame,
1815
+ CommandBar: Commands,
1816
+ InfoBar: Infos,
1817
+ VideoProgress,
1818
+ Settings,
1819
+ // Help,
1820
+ },
1821
+ data() {
1822
+ return {
1823
+ Positions,
1824
+ updatingChannel: null,
1825
+ dialog: false,
1826
+ timeLastBlock: null,
1827
+ alternativeServer: false,
1828
+ useCache: true,
1829
+ numberOfRows: 1,
1830
+ framesPerRow: 5,
1831
+ secondsPerFrame: 1,
1832
+ fInterface: null,
1833
+ velocity: 1,
1834
+ frames: [],
1835
+ previousFrames: [],
1836
+ nextFrames: [],
1837
+ channelCode: 0,
1838
+ videoPlaying: false,
1839
+ activeFrame: null,
1840
+ activeVideo: null,
1841
+ videoTime: 0,
1842
+ videoTotalTime: null,
1843
+ progressVideoDrag: false,
1844
+ hourIniSelected: false,
1845
+ hourEndSelected: false,
1846
+ canInsertTime: false,
1847
+ lastHeight: 0,
1848
+ loopInterval: null,
1849
+ nextLoop: false,
1850
+ prevLoop: false,
1851
+ videoSliderTotalDuration: 900,
1852
+ blockStartTime: null,
1853
+ media: null,
1854
+ changeServer: false,
1855
+ userMultiTabsGrid: false,
1856
+ userMultiTabsGridsModel: true,
1857
+ playbackRate: 1,
1858
+ paused: false,
1859
+ commandBarShow: true,
1860
+ dialogs: {
1861
+ playbackRate: false,
1862
+ goTo: false,
1863
+ secondsPerFrame: false,
1864
+ frames: false,
1865
+ },
1866
+ }
1867
+ },
1868
+ async created() {
1869
+ this.changeServer = this.serverOfFrames === 'alternative';
1870
+ this.alternativeServer = this.serverOfFrames === 'alternative';
1871
+
1872
+ const settings = [
1873
+ {
1874
+ framesPerRow: 2,
1875
+ numberOfRows: 1,
1876
+ },
1877
+ {
1878
+ framesPerRow: 3,
1879
+ numberOfRows: 1,
1880
+ },
1881
+ {
1882
+ framesPerRow: 3,
1883
+ numberOfRows: 2,
1884
+ },
1885
+ {
1886
+ framesPerRow: 4,
1887
+ numberOfRows: 1,
1888
+ },
1889
+ {
1890
+ framesPerRow: 4,
1891
+ numberOfRows: 2,
1892
+ },
1893
+ {
1894
+ framesPerRow: 5,
1895
+ numberOfRows: 1,
1896
+ },
1897
+ {
1898
+ framesPerRow: 5,
1899
+ numberOfRows: 2,
1900
+ },
1901
+ {
1902
+ framesPerRow: 6,
1903
+ numberOfRows: 1,
1904
+ },
1905
+ {
1906
+ framesPerRow: 6,
1907
+ numberOfRows: 2,
1908
+ },
1909
+ ];
1910
+
1911
+ const storedOnDb = settings[parseInt(this.framesFormat) - 1];
1912
+ this.framesPerRow = storedOnDb.framesPerRow;
1913
+ this.numberOfRows = storedOnDb.numberOfRows;
1914
+
1915
+ await this.createFramesInterface();
1916
+ if (this.maxSize) {
1917
+ this.resize(this.maxSize, true);
1918
+ }
1919
+ },
1920
+ methods: {
1921
+ framesClicked(e) {
1922
+ if (e.target.id != 'insert') {
1923
+ this.active = true;
1924
+ }
1925
+ },
1926
+ async goToStartBlock() {
1927
+ try {
1928
+ const d = new Date();
1929
+ let timestamp = Date.UTC(
1930
+ d.getFullYear(),
1931
+ d.getMonth(),
1932
+ d.getDate(),
1933
+ d.getHours(),
1934
+ d.getMinutes(),
1935
+ d.getSeconds()
1936
+ );
1937
+
1938
+ const response = (
1939
+ await FramesService.getNextAvailableBlock({
1940
+ channel: this.channel,
1941
+ time: timestamp / 1000,
1942
+ })
1943
+ ).data;
1944
+
1945
+ this.dialog = false;
1946
+ this.changeHour(this.convertToAudienceTime(response.data.start, ':'));
1947
+ } catch (err) {
1948
+ console.error(err);
1949
+ }
1950
+ },
1951
+ async checkAvailableBlock() {
1952
+ try {
1953
+ const d = new Date();
1954
+ let timestamp = Date.UTC(
1955
+ d.getFullYear(),
1956
+ d.getMonth(),
1957
+ d.getDate(),
1958
+ d.getHours(),
1959
+ d.getMinutes(),
1960
+ d.getSeconds()
1961
+ );
1962
+
1963
+ const response = (
1964
+ await FramesService.getNextAvailableBlock({
1965
+ channel: this.channel,
1966
+ time: timestamp / 1000,
1967
+ })
1968
+ ).data;
1969
+
1970
+ this.timeLastBlock = this.convertToAudienceTime(response.data.end, ':');
1971
+ this.dialog = true;
1972
+ if (!response.status) {
1973
+ this.timeLastBlock = 'N/D';
1974
+ }
1975
+ } catch (err) {
1976
+ console.error(err);
1977
+ }
1978
+ },
1979
+ updateSlider(videoStartTime, time) {
1980
+ // * atualizar slider se estiver fora do range definido previamente
1981
+ if (
1982
+ time < this.blockStartTime ||
1983
+ time > this.blockStartTime ||
1984
+ videoStartTime > this.blockStartTime + this.videoSliderTotalDuration
1985
+ ) {
1986
+ this.blockStartTime = videoStartTime;
1987
+ this.videoSliderTotalDuration = 900;
1988
+ }
1989
+ },
1990
+ nextLoopActivate() {
1991
+ this.breakLoop();
1992
+ this.loopInterval = setInterval(this.next, 40);
1993
+ setTimeout(() => {
1994
+ this.nextLoop = true;
1995
+ }, 0);
1996
+ },
1997
+ prevLoopActivate() {
1998
+ this.breakLoop();
1999
+ this.loopInterval = setInterval(this.prev, 40);
2000
+ setTimeout(() => {
2001
+ this.prevLoop = true;
2002
+ }, 0);
2003
+ },
2004
+ breakLoop() {
2005
+ clearInterval(this.loopInterval);
2006
+ this.loopInterval = null;
2007
+ this.nextLoop = false;
2008
+ this.prevLoop = false;
2009
+ },
2010
+ changePlayPause(status) {
2011
+ this.paused = !status;
2012
+ },
2013
+ resize(height=this.lastHeight) {
2014
+ this.lastHeight = height;
2015
+ if (this.$refs.frames) {
2016
+ for (let frame of this.$refs.frames) {
2017
+ frame.resize(height);
2018
+ }
2019
+ }
2020
+ this.$emit('resized');
2021
+ },
2022
+ async goToFirstFrame() {
2023
+ let frames = this.$refs.frames;
2024
+
2025
+ let audienceTime = null;
2026
+ if (frames.length > 0) {
2027
+ let frame = frames[0].frame;
2028
+ audienceTime = this.getAudienceTime(frame.time, 0, 0, 0);
2029
+ }
2030
+ // if (audienceTime) {
2031
+ // this.changeHour(this.getLastFirtsBlockTime(audienceTime, true))
2032
+ // }
2033
+ if (audienceTime) {
2034
+ const [hours, minutes, seconds] = audienceTime.split(':');
2035
+ const totalSeconds =
2036
+ parseInt(hours) * 3600 + parseInt(minutes) * 60 + parseInt(seconds);
2037
+ if (totalSeconds >= 9000)
2038
+ this.changeHour(this.getLastFirtsBlockTime(audienceTime, true));
2039
+ else this.changeHour(this.getLastFirtsBlockTime('02:30:00', true));
2040
+ }
2041
+ },
2042
+ async goToLastFrame() {
2043
+ let frames = this.$refs.frames;
2044
+ let audienceTime = null;
2045
+ if (frames.length > 0) {
2046
+ let frame = frames[0].frame;
2047
+
2048
+ audienceTime = this.getAudienceTime(frame.time, 0, 0, 0);
2049
+ }
2050
+ if (audienceTime) {
2051
+ this.changeHour(this.getLastFirtsBlockTime(audienceTime));
2052
+ }
2053
+ },
2054
+ getLastFirtsBlockTime(time, first = false) {
2055
+ if (time.indexOf(':') !== -1) {
2056
+ time = time.replace(/:/g, '');
2057
+ }
2058
+ let h, m, newTime;
2059
+ const t = time.match(/.{1,2}/g);
2060
+ if (t[0] && t[1]) {
2061
+ h = parseInt(t[0]);
2062
+ m = parseInt(t[1]);
2063
+ }
2064
+ if (h < 26) {
2065
+ if (m < 15)
2066
+ if (first) newTime = t[0] + ':00:00';
2067
+ else newTime = t[0] + ':14:59';
2068
+ else if (m < 30)
2069
+ if (first) newTime = t[0] + ':15:00';
2070
+ else newTime = t[0] + ':29:59';
2071
+ else if (m < 45)
2072
+ if (first) newTime = t[0] + ':30:00';
2073
+ else newTime = t[0] + ':44:59';
2074
+ else if (first) newTime = t[0] + ':45:00';
2075
+ else newTime = t[0] + ':59:59';
2076
+ } else {
2077
+ if (m < 15)
2078
+ if (first) newTime = '26:00:00';
2079
+ else newTime = '26:14:59';
2080
+ else {
2081
+ if (first) newTime = '26:15:00';
2082
+ else newTime = '26:29:59';
2083
+ }
2084
+ }
2085
+ return newTime
2086
+ },
2087
+ openBlocks() {
2088
+ this.$refs.settings2?.openBlocks();
2089
+ },
2090
+ playOrPause() {
2091
+ const array = this.$refs.frames.filter((fc) => !!fc.active);
2092
+ if (array.length === 1) {
2093
+ const frame = array[0];
2094
+ frame.playOrPause(this.playbackRate);
2095
+ }
2096
+ },
2097
+ stopPlayingBar() {
2098
+ for (let ref of this.$refs.frames) {
2099
+ if (
2100
+ ref.videoStatus === ref.Status.playing ||
2101
+ ref.videoStatus === ref.Status.paused
2102
+ ) {
2103
+ ref.stop(false);
2104
+ }
2105
+ }
2106
+ },
2107
+ async setFrameSelection(selected) {
2108
+ this.frames = this.loadingArray;
2109
+ switch (parseInt(selected)) {
2110
+ // 2x1
2111
+ case 1:
2112
+ this.framesPerRow = 2;
2113
+ this.numberOfRows = 1;
2114
+ break
2115
+ // 3x1
2116
+ case 2:
2117
+ this.framesPerRow = 3;
2118
+ this.numberOfRows = 1;
2119
+ break
2120
+ // 3x2
2121
+ case 3:
2122
+ this.framesPerRow = 3;
2123
+ this.numberOfRows = 2;
2124
+ break
2125
+ // 4x1
2126
+ case 4:
2127
+ this.framesPerRow = 4;
2128
+ this.numberOfRows = 1;
2129
+ break
2130
+ // 4x2
2131
+ case 5:
2132
+ this.framesPerRow = 4;
2133
+ this.numberOfRows = 2;
2134
+ break
2135
+ // 5x1
2136
+ case 6:
2137
+ this.framesPerRow = 5;
2138
+ this.numberOfRows = 1;
2139
+ break
2140
+ // 5x2
2141
+ case 7:
2142
+ this.framesPerRow = 5;
2143
+ this.numberOfRows = 2;
2144
+ break
2145
+ // 6x1
2146
+ case 8:
2147
+ this.framesPerRow = 6;
2148
+ this.numberOfRows = 1;
2149
+ break
2150
+ // 6x2
2151
+ case 9:
2152
+ this.framesPerRow = 6;
2153
+ this.numberOfRows = 2;
2154
+ break
2155
+ }
2156
+ await this.fInterface.changeSize(this.numberOfRows, this.framesPerRow);
2157
+ this.getFramesArray();
2158
+ setTimeout(() => {
2159
+ for (let ref of this.$refs.frames) {
2160
+ ref?.resize(this.lastHeight);
2161
+ }
2162
+ }, 150);
2163
+ },
2164
+ getFramesArray() {
2165
+ this.frames = this.fInterface.getFrames(Positions.current);
2166
+ this.nextFrames = this.fInterface.getFrames(Positions.next);
2167
+ this.previousFrames = this.fInterface.getFrames(Positions.previous);
2168
+ },
2169
+ async createFramesInterface() {
2170
+ this.frames = this.loadingArray;
2171
+ let ch = this.channel;
2172
+ let associationTMP = {
2173
+ 1735073: 1,
2174
+ 1735074: 139,
2175
+ 1735075: 3,
2176
+ 1735076: 132,
2177
+ };
2178
+ //
2179
+ this.channelCode = associationTMP[ch] ? associationTMP[ch] : ch;
2180
+
2181
+ const t = this.startAudienceTime.match(/.{1,2}/g);
2182
+ const d = this.getDateParts();
2183
+ const time = Date.UTC(d.year, d.month, d.day, t[0], t[1], t[2]) / 1000;
2184
+ // * iniciar slider
2185
+ this.blockStartTime = time;
2186
+ this.fInterface = await new FramesInterface(
2187
+ this.channelCode,
2188
+ this.numberOfRows,
2189
+ this.framesPerRow,
2190
+ time,
2191
+ this.startAudienceTime,
2192
+ this.useCache
2193
+ );
2194
+ await this.fInterface.init();
2195
+
2196
+ this.getFramesArray();
2197
+
2198
+ this.activeFrame = this.getIndex(1, 0, Positions.current);
2199
+
2200
+ this.activeVideo = null;
2201
+ },
2202
+ getIndex(rowNumber, frameIndex, position) {
2203
+ let from = this.framesPerRow * this.numberOfRows * position;
2204
+ let till = this.framesPerRow * this.numberOfRows * (position + 1);
2205
+
2206
+ return (from + till * (rowNumber - 1)) / rowNumber + frameIndex
2207
+ },
2208
+ getAudienceTime(frameTime, rowNumber, frameNumber, position) {
2209
+ if (!frameTime) {
2210
+ return 'Loading...'
2211
+ } else if (
2212
+ this.getIndex(rowNumber, frameNumber, position) === this.activeVideo
2213
+ ) {
2214
+ return this.convertToAudienceTime(this.videoTime)
2215
+ } else {
2216
+ return this.convertToAudienceTime(frameTime)
2217
+ }
2218
+ },
2219
+ dateInUtc(miliSeconds) {
2220
+ var date = new Date(miliSeconds);
2221
+ var utc = new Date(
2222
+ date.getUTCFullYear(),
2223
+ date.getUTCMonth(),
2224
+ date.getUTCDate(),
2225
+ date.getUTCHours(),
2226
+ date.getUTCMinutes(),
2227
+ date.getUTCSeconds()
2228
+ );
2229
+ return utc
2230
+ },
2231
+ convertToAudienceTime(time, separator = ':') {
2232
+ const d = this.getDateParts();
2233
+ const limit = Date.UTC(d.year, d.month, d.day, 23, 59, 59) / 1000;
2234
+
2235
+ let hour = this.dateInUtc(time * 1000)
2236
+ .toTimeString()
2237
+ .split(' ')[0]
2238
+ .split(':')
2239
+ .map(Number);
2240
+
2241
+ if (time > limit && time <= limit + this.startAudienceSeconds) {
2242
+ hour[0] = 24 + hour[0];
2243
+ }
2244
+ return hour
2245
+ .map((part) => (part > 9 ? part.toString() : '0' + part))
2246
+ .join(separator)
2247
+ },
2248
+ getDateParts(date = this.date) {
2249
+ const d = new Date(date);
2250
+ return {
2251
+ year: d.getFullYear(),
2252
+ month: d.getMonth(),
2253
+ day: d.getDate(),
2254
+ }
2255
+ },
2256
+ selectFrame(index, frame) {
2257
+ const d = this.getDateParts();
2258
+ const limit = Date.UTC(d.year, d.month, d.day, 23, 59, 59) / 1000;
2259
+ const frameTime = frame?.time;
2260
+
2261
+ if (frameTime - (this.startAudienceSeconds + limit) <= 0) {
2262
+ if (this.hourIniSelected === true) {
2263
+ this.hourIniSelected = frameTime;
2264
+
2265
+ if (
2266
+ this.hourEndSelected &&
2267
+ this.hourIniSelected > this.hourEndSelected
2268
+ ) {
2269
+ this.hourEndSelected = false;
2270
+ }
2271
+ } else if (this.hourEndSelected === true) {
2272
+ if (frameTime > this.hourIniSelected) {
2273
+ this.hourEndSelected = frameTime;
2274
+ this.canInsertTime = true;
2275
+ } else {
2276
+ this.hourEndSelected = false;
2277
+ }
2278
+ }
2279
+ }
2280
+
2281
+ if (this.activeFrame !== index) {
2282
+ // ? Se clicar no frame diferente de onde está a dar play, faz pausa
2283
+ const array = this.$refs.frames.filter(
2284
+ (fc) => fc.videoStatus === fc.Status.playing
2285
+ );
2286
+ if (array.length === 1) {
2287
+ const frame = array[0];
2288
+ frame.playOrPause();
2289
+ }
2290
+ this.activeVideo = null;
2291
+ this.activeFrame = index;
2292
+ }
2293
+ },
2294
+ setHourIni() {
2295
+ this.canInsertTime = true;
2296
+ this.hourIniSelected = true;
2297
+ document.getElementById(`frame-${this.activeFrame}`).click();
2298
+ this.$emit('setHourIni', {
2299
+ hour_ini: this.hourIniSelected
2300
+ ? this.convertToAudienceTime(this.hourIniSelected, '')
2301
+ : null,
2302
+ });
2303
+ },
2304
+ setHourEnd() {
2305
+ this.canInsertTime = true;
2306
+ this.hourEndSelected = true;
2307
+ document.getElementById(`frame-${this.activeFrame}`).click();
2308
+ },
2309
+ //* Navegação
2310
+ arrowRight() {
2311
+ if (this.checkLimitRight(false)) {
2312
+ if (
2313
+ this.activeFrame ===
2314
+ this.numberOfRows * this.framesPerRow * 2 - 1
2315
+ ) {
2316
+ this.next();
2317
+ } else {
2318
+ this.activeFrame++;
2319
+ }
2320
+ }
2321
+ },
2322
+ arrowLeft() {
2323
+ if (this.checkLimitLeft(false)) {
2324
+ if (this.activeFrame === this.numberOfRows * this.framesPerRow) {
2325
+ this.prev();
2326
+ } else {
2327
+ this.activeFrame--;
2328
+ }
2329
+ }
2330
+ },
2331
+ checkLimitRight(value) {
2332
+ const d = this.getDateParts();
2333
+ const high = Date.UTC(d.year, d.month, d.day, 26, 29, 59);
2334
+
2335
+ if (value) {
2336
+ return (
2337
+ high > (this.fInterface.getCurrentTime() - 1) * 1000 &&
2338
+ this.nextFrames[0].title !== -1
2339
+ )
2340
+ } else {
2341
+ // return high > (this.fInterface.getCurrentTime() + this.activeFrame) * 1000
2342
+ return high > this.fInterface.getCurrentTime() * 1000
2343
+ }
2344
+ },
2345
+ checkLimitLeft(value) {
2346
+ const d = this.getDateParts();
2347
+ const low = Date.UTC(d.year, d.month, d.day, 2, 30, 0);
2348
+
2349
+ if (value) {
2350
+ return low <= (this.fInterface.getCurrentTime() - 1) * 1000
2351
+ } else {
2352
+ return (
2353
+ low <
2354
+ (this.fInterface.getCurrentTime() +
2355
+ this.activeFrame -
2356
+ this.numberOfRows * this.framesPerRow) *
2357
+ 1000
2358
+ )
2359
+ }
2360
+ },
2361
+ async next() {
2362
+ if (this.checkLimitRight(true)) {
2363
+ const array = this.$refs.frames.filter(
2364
+ (fc) =>
2365
+ fc.videoStatus === fc.Status.playing ||
2366
+ fc.videoStatus === fc.Status.paused
2367
+ );
2368
+
2369
+ if (array.length === 1) {
2370
+ const frame = array[0];
2371
+ frame.stop(false);
2372
+ }
2373
+ this.fInterface.setCurrentStep(this.secondsPerFrame);
2374
+ await this.fInterface.loadNextFrames();
2375
+
2376
+ this.activeFrame = this.getIndex(1, 0, Positions.current);
2377
+ this.activeVideo = null;
2378
+
2379
+ this.getFramesArray();
2380
+ }
2381
+ },
2382
+ async prev() {
2383
+ if (this.checkLimitLeft(true)) {
2384
+ const array = this.$refs.frames.filter(
2385
+ (fc) =>
2386
+ fc.videoStatus === fc.Status.playing ||
2387
+ fc.videoStatus === fc.Status.paused
2388
+ );
2389
+ if (array.length === 1) {
2390
+ const frame = array[0];
2391
+ frame.stop(false);
2392
+ }
2393
+
2394
+ this.fInterface.setCurrentStep(this.secondsPerFrame);
2395
+ await this.fInterface.loadPrevFrames();
2396
+
2397
+ this.activeFrame = this.getIndex(
2398
+ this.numberOfRows,
2399
+ this.framesPerRow - 1,
2400
+ Positions.current
2401
+ );
2402
+ this.activeVideo = null;
2403
+
2404
+ this.getFramesArray();
2405
+ }
2406
+ },
2407
+ async setStartTime(time) {
2408
+ if (time.indexOf(':') !== -1) {
2409
+ time = time.replace(/:/g, '');
2410
+ }
2411
+ const t = time.match(/.{1,2}/g);
2412
+ const d = this.getDateParts();
2413
+ const setTime = Date.UTC(d.year, d.month, d.day, t[0], t[1], t[2]) / 1000;
2414
+ this.frames = this.loadingArray;
2415
+
2416
+ await this.fInterface.changeTime(setTime);
2417
+
2418
+ this.getFramesArray();
2419
+
2420
+ this.activeFrame = this.getIndex(1, 0, Positions.current);
2421
+ // let frames = this.$refs.frames
2422
+
2423
+ // let audienceTime = null
2424
+ // if (frames.length > 0) {
2425
+ // let frame = frames[0].frame
2426
+ // audienceTime = this.getAudienceTime(frame.time, 0, 0, 0)
2427
+ // }
2428
+
2429
+ this.activeVideo = null;
2430
+
2431
+ return true
2432
+ },
2433
+ hourToTimeStamp(time) {
2434
+ if (time.indexOf(':') !== -1) {
2435
+ time = time.replace(/:/g, '');
2436
+ }
2437
+ const t = time.match(/.{1,2}/g);
2438
+ const d = this.getDateParts();
2439
+ const setTime = Date.UTC(d.year, d.month, d.day, t[0], t[1], t[2]) / 1000;
2440
+
2441
+ return setTime
2442
+ },
2443
+ async changeHour(value) {
2444
+ if (value) {
2445
+ setTimeout(() => {
2446
+ const array = this.$refs.frames.filter(
2447
+ (fc) =>
2448
+ fc.videoStatus === fc.Status.playing ||
2449
+ fc.videoStatus === fc.Status.paused
2450
+ );
2451
+
2452
+ if (array.length === 1) {
2453
+ const frame = array[0];
2454
+ frame.stop(false);
2455
+ }
2456
+
2457
+ this.setStartTime(value, true);
2458
+ }, 0);
2459
+ }
2460
+ },
2461
+ changeBlockInterval(value) {
2462
+ this.changeHour(value.ini);
2463
+ let time_ini, time_end;
2464
+ time_ini = this.hourToTimeStamp(value.ini);
2465
+ time_end = this.hourToTimeStamp(value.end);
2466
+ this.videoSliderTotalDuration = time_end - time_ini;
2467
+ this.$refs.frames[0].changeSettings(time_ini);
2468
+ this.blockStartTime = time_ini;
2469
+ },
2470
+ //eslint-disable-next-line
2471
+ async updateVideoTime(index, videoTime) {
2472
+ this.activeVideo = index;
2473
+ this.videoTime = videoTime;
2474
+ },
2475
+ //eslint-disable-next-line
2476
+ updateVideoStatus(currentTime) {
2477
+ if (!this.progressVideoDrag) ;
2478
+ },
2479
+ async startPlaying(frame, totalTime) {
2480
+ const array = this.$refs.frames.filter(
2481
+ (fc) => fc.frame.time !== frame.time
2482
+ );
2483
+
2484
+ for (let ref of array) {
2485
+ if (
2486
+ ref.videoStatus === ref.Status.playing ||
2487
+ ref.videoStatus === ref.Status.paused
2488
+ ) {
2489
+ ref.stop(false);
2490
+ }
2491
+ }
2492
+
2493
+ this.videoTotalTime = totalTime;
2494
+ this.videoPlaying = true;
2495
+ },
2496
+ stopPlaying() {
2497
+ this.videoTotalTime = null;
2498
+ this.videoPlaying = false;
2499
+ this.paused = false;
2500
+ },
2501
+ insertTime() {
2502
+ this.$emit('timeToInsert', {
2503
+ channel: this.channel,
2504
+ hour_ini: this.hourIniSelected
2505
+ ? this.convertToAudienceTime(this.hourIniSelected, '')
2506
+ : null,
2507
+ hour_end: this.hourEndSelected
2508
+ ? this.convertToAudienceTime(this.hourEndSelected, '')
2509
+ : null,
2510
+ force: false,
2511
+ });
2512
+
2513
+ if (this.jumpOnInsert) {
2514
+ this.changeHour(
2515
+ this.convertToAudienceTime(
2516
+ (this.hourEndSelected || this.hourIniSelected) + 1
2517
+ )
2518
+ );
2519
+ }
2520
+
2521
+ this.hourIniSelected = null;
2522
+ this.hourEndSelected = null;
2523
+ this.canInsertTime = false;
2524
+
2525
+ // this.fInterface.setCurrentPosition(this.hourEndSelected)
2526
+ },
2527
+ insertTimeForce() {
2528
+ this.$emit('timeToInsert', {
2529
+ channel: this.channel,
2530
+ hour_ini: this.hourIniSelected
2531
+ ? this.convertToAudienceTime(this.hourIniSelected, '')
2532
+ : null,
2533
+ hour_end: this.hourEndSelected
2534
+ ? this.convertToAudienceTime(this.hourEndSelected, '')
2535
+ : null,
2536
+ force: true,
2537
+ });
2538
+
2539
+ this.hourIniSelected = null;
2540
+ this.hourEndSelected = null;
2541
+ this.canInsertTime = false;
2542
+
2543
+ // this.fInterface.setCurrentPosition(this.hourEndSelected)
2544
+ },
2545
+ async getChannelMedia() {
2546
+ // this.media = (await ChannelService.show(this.channel)).data.MEDIA
2547
+ },
2548
+ async changeServerClick() {
2549
+ this.changeServer = !this.changeServer;
2550
+ // this.$store.dispatch(
2551
+ // 'serverOfFrames',
2552
+ // this.changeServer ? 'alternative' : 'default'
2553
+ // )
2554
+ sessionStorage.setItem(
2555
+ 'serverOfFrames',
2556
+ this.changeServer ? 'alternative' : 'default'
2557
+ );
2558
+
2559
+ // if (this.$route.params.time != this.frames[0].time)
2560
+ // this.$router.push({
2561
+ // name: 'grid',
2562
+ // params: {
2563
+ // date: this.date,
2564
+ // channel: this.channelCode,
2565
+ // time: this.frames[0].time,
2566
+ // },
2567
+ // })
2568
+ location.reload();
2569
+ },
2570
+ },
2571
+ computed: {
2572
+ active: {
2573
+ get() {
2574
+ return this.value
2575
+ },
2576
+ set(value) {
2577
+ this.$emit('input', value);
2578
+ },
2579
+ },
2580
+ settingsClosed() {
2581
+ return !Object.values(this.dialogs).find((v) => v)
2582
+ },
2583
+ startAudienceSeconds() {
2584
+ const t = this.startAudienceTime.match(/.{1,2}/g);
2585
+ return parseInt(t[0] * 3600 + t[1] * 60 + t[2])
2586
+ },
2587
+ loadingArray() {
2588
+ return Array.from(Array(this.numberOfRows * this.framesPerRow).keys())
2589
+ },
2590
+ serverOfFrames() {
2591
+ return sessionStorage.getItem('server')
2592
+ },
2593
+ },
2594
+ watch: {
2595
+ framesFormat(value) {
2596
+ this.setFrameSelection(value);
2597
+ },
2598
+ active() {
2599
+ // ? sempre que trocamos de tabs dar reset as horas selected
2600
+ this.hourIniSelected = false;
2601
+ this.hourEndSelected = false;
2602
+ },
2603
+ useCache() {
2604
+ this.createFramesInterface();
2605
+ },
2606
+ hourIniSelected(value) {
2607
+ if (value) {
2608
+ sessionStorage.setItem(
2609
+ 'currentTimeFrames',
2610
+ this.convertToAudienceTime(this.hourIniSelected, '')
2611
+ );
2612
+ } else {
2613
+ sessionStorage.removeItem('currentTimeFrames');
2614
+ }
2615
+ },
2616
+ activeFrame(value) {
2617
+ if (value) {
2618
+ this.stopPlayingBar();
2619
+ }
2620
+ },
2621
+ channel() {
2622
+ this.updatingChannel = new Promise((resolve, reject) => {
2623
+ try {
2624
+ this.createFramesInterface();
2625
+ resolve(true);
2626
+ } catch (err) {
2627
+ reject(err);
2628
+ }
2629
+ });
2630
+ },
2631
+ },
2632
+ };
2633
+
2634
+ var Visualization$1 = /*#__PURE__*/Object.freeze({
2635
+ __proto__: null,
2636
+ 'default': Visualization
2637
+ });
2638
+
2639
+ export { index as default };