@flexem/fc-gui 3.0.0-alpha.87 → 3.0.0-alpha.88
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.
- package/CHANGELOG.md +7 -2
- package/bundles/@flexem/fc-gui.umd.js +85 -118
- package/bundles/@flexem/fc-gui.umd.js.map +1 -1
- package/bundles/@flexem/fc-gui.umd.min.js +4 -4
- package/bundles/@flexem/fc-gui.umd.min.js.map +1 -1
- package/elements/video/video-element.d.ts +1 -6
- package/elements/video/video-element.js +79 -118
- package/elements/video/video-element.metadata.json +1 -1
- package/elements/view-operation/view-operation.element.js +6 -0
- package/package.json +1 -1
|
@@ -16,17 +16,12 @@ export declare class VideoElement extends ConditionalDisplayElement {
|
|
|
16
16
|
private videoId;
|
|
17
17
|
private isShow;
|
|
18
18
|
private videoPlayer;
|
|
19
|
-
private resetTimer;
|
|
20
|
-
private refreshTimer;
|
|
21
|
-
private isMobileType;
|
|
22
|
-
private clientRect;
|
|
23
|
-
private videoClientRect;
|
|
24
19
|
constructor(element: HTMLElement, injector: Injector, permissionChecker: PermissionChecker, variableCommunicator: VariableCommunicator, variableStore: VariableStore, videoService: VideoService, guiSize: Size, svgRootClass: string, signalRAppId: string);
|
|
25
20
|
dispose(): void;
|
|
26
21
|
hide(): void;
|
|
27
22
|
show(): void;
|
|
28
23
|
private init;
|
|
24
|
+
private initVideo;
|
|
29
25
|
private addVideoAddressToolTip;
|
|
30
26
|
private setAndroidVideo;
|
|
31
|
-
private bindFullscreenEvent;
|
|
32
27
|
}
|
|
@@ -46,88 +46,64 @@ export class VideoElement extends ConditionalDisplayElement {
|
|
|
46
46
|
return;
|
|
47
47
|
}
|
|
48
48
|
this.videoId = Guid.newGuid().toString('n');
|
|
49
|
+
this.rootElement.append('rect').attr('id', 'rect' + this.videoId).attr('fill', 'transparent')
|
|
50
|
+
.attr('width', this.model.size.width)
|
|
51
|
+
.attr('height', this.model.size.height);
|
|
49
52
|
this.videoService.getVideoUrl(this.model.videoTag).then(result => {
|
|
50
|
-
this.
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
this.
|
|
64
|
-
return;
|
|
53
|
+
this.initVideo(result.url, result.isMobileType, this.videoId);
|
|
54
|
+
}).catch(() => {
|
|
55
|
+
throw new Error('Failure of the videoService');
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
initVideo(videoUrl, isMobileType, videoId) {
|
|
59
|
+
const patt = /https:.+.m3u8/;
|
|
60
|
+
if (videoUrl.indexOf('http:') !== -1) {
|
|
61
|
+
videoUrl = videoUrl.replace('http:', 'https:');
|
|
62
|
+
}
|
|
63
|
+
if (!patt.test(videoUrl)) {
|
|
64
|
+
let videoToolTip = this.localization.invalidVideoAddress;
|
|
65
|
+
if (isNil(videoUrl) || videoUrl === '') {
|
|
66
|
+
videoToolTip = this.localization.unconfiguredVideoAddress;
|
|
65
67
|
}
|
|
66
|
-
this.
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
video.attr('autoplay', true);
|
|
68
|
+
this.addVideoAddressToolTip(videoToolTip);
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
const currentRect = this.$element.find('rect#rect' + videoId).first();
|
|
72
|
+
if (!currentRect.length) {
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
const clientRect = currentRect[0].getBoundingClientRect();
|
|
76
|
+
const chartWidth = clientRect.width;
|
|
77
|
+
const chartHeight = clientRect.height;
|
|
78
|
+
const left = this.model.location.x / this.guiSize.width * $('.' + this.svgRootClass).find('.svg-content').width();
|
|
79
|
+
const top = this.model.location.y / this.guiSize.height * $('.' + this.svgRootClass).find('.svg-content').height();
|
|
80
|
+
let videoHtml = `<video scareX="${this.model.location.x / this.guiSize.width}"
|
|
81
|
+
scareY="${this.model.location.y / this.guiSize.height}" id="${videoId}" src="${videoUrl}" style="
|
|
82
|
+
position: absolute;top:${top}px;left:${left}px;width:${chartWidth}px;height:${chartHeight}px;object-fit:fill;z-index:0"
|
|
83
|
+
playsInline webkit-playsinline `;
|
|
84
|
+
const isAndroid = !!navigator.userAgent.match(/(Android)/i);
|
|
85
|
+
if (this.isMobileMode) {
|
|
86
|
+
if (isAndroid) {
|
|
87
|
+
if (isMobileType) {
|
|
88
|
+
videoHtml += ' controls ';
|
|
88
89
|
}
|
|
90
|
+
videoHtml += ' autoplay muted></video>';
|
|
89
91
|
}
|
|
90
92
|
else {
|
|
91
|
-
video
|
|
92
|
-
}
|
|
93
|
-
if (this.isShow === false) {
|
|
94
|
-
$('#' + this.videoId).hide();
|
|
93
|
+
videoHtml += ' controls muted></video>';
|
|
95
94
|
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
this.videoClientRect = document.getElementById(this.videoId).getBoundingClientRect();
|
|
109
|
-
video.style('position', 'absolute');
|
|
110
|
-
video.style('left', this.clientRect.left + 'px');
|
|
111
|
-
video.style('top', this.clientRect.top - svgClientRect.top + 'px');
|
|
112
|
-
video.style('transform', `scale(${this.clientRect.width / this.videoClientRect.width}, ${this.clientRect.height / this.videoClientRect.height})`);
|
|
113
|
-
video.style('transform-origin', 'left top');
|
|
114
|
-
}, 300);
|
|
115
|
-
$('#' + this.videoId).bind('webkitendfullscreen', () => {
|
|
116
|
-
setTimeout(() => {
|
|
117
|
-
video.style('width', this.videoClientRect.width + 'px');
|
|
118
|
-
video.style('height', this.videoClientRect.height + 'px');
|
|
119
|
-
}, 1000);
|
|
120
|
-
});
|
|
121
|
-
}
|
|
122
|
-
this.videoPlayer = new EZUIPlayer(this.videoId);
|
|
123
|
-
if (isAndroid) {
|
|
124
|
-
setTimeout(() => {
|
|
125
|
-
this.setAndroidVideo();
|
|
126
|
-
}, 500);
|
|
127
|
-
}
|
|
128
|
-
}).catch(() => {
|
|
129
|
-
throw new Error('Failure of the videoService');
|
|
130
|
-
});
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
videoHtml += ' controls autoplay muted></video>';
|
|
98
|
+
}
|
|
99
|
+
$('.' + this.svgRootClass).find('.svg-content').append(videoHtml);
|
|
100
|
+
if (this.isShow === false) {
|
|
101
|
+
$('#' + this.videoId).hide();
|
|
102
|
+
}
|
|
103
|
+
this.videoPlayer = new EZUIPlayer(videoId);
|
|
104
|
+
if (isAndroid && !isMobileType) {
|
|
105
|
+
this.setAndroidVideo(videoId);
|
|
106
|
+
}
|
|
131
107
|
}
|
|
132
108
|
addVideoAddressToolTip(videoToolTip) {
|
|
133
109
|
const size = this.model.size;
|
|
@@ -149,50 +125,35 @@ export class VideoElement extends ConditionalDisplayElement {
|
|
|
149
125
|
const textElement = new TextElementModal(videoToolTip, font, size.width, size.height);
|
|
150
126
|
this.$element.append(textElement.Element);
|
|
151
127
|
}
|
|
152
|
-
setAndroidVideo() {
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
'z-index': 99
|
|
174
|
-
});
|
|
175
|
-
StatusBar.hide();
|
|
128
|
+
setAndroidVideo(videoId) {
|
|
129
|
+
let isFullscreen = false;
|
|
130
|
+
const videoElement = $('#' + videoId);
|
|
131
|
+
let preHeight = videoElement.height();
|
|
132
|
+
let preWidth = videoElement.width();
|
|
133
|
+
let preTop = videoElement.css('top');
|
|
134
|
+
let preLeft = videoElement.css('left');
|
|
135
|
+
videoElement.on('click', () => {
|
|
136
|
+
if (!isFullscreen) {
|
|
137
|
+
preHeight = videoElement.height();
|
|
138
|
+
preWidth = videoElement.width();
|
|
139
|
+
preTop = videoElement.css('top');
|
|
140
|
+
preLeft = videoElement.css('left');
|
|
141
|
+
const width = document.body.clientWidth;
|
|
142
|
+
const height = width * 9 / 16;
|
|
143
|
+
videoElement.css('width', width + 'px');
|
|
144
|
+
videoElement.css('height', height + 'px');
|
|
145
|
+
videoElement.css('left', '0px');
|
|
146
|
+
videoElement.css('top', '0px');
|
|
147
|
+
videoElement.css('z-index', '99');
|
|
148
|
+
isFullscreen = true;
|
|
176
149
|
}
|
|
177
150
|
else {
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
this.resetTimer = null;
|
|
185
|
-
$('#' + this.videoId).css('display', 'none');
|
|
186
|
-
this.resetTimer = setTimeout(() => {
|
|
187
|
-
$('#' + this.videoId).css({
|
|
188
|
-
'width': '100%',
|
|
189
|
-
'height': '100%',
|
|
190
|
-
'display': 'block',
|
|
191
|
-
'z-index': 0,
|
|
192
|
-
'object-fit': document.webkitIsFullScreen ? 'contain' : 'fill'
|
|
193
|
-
});
|
|
194
|
-
}, 1000);
|
|
195
|
-
}
|
|
151
|
+
videoElement.css('width', preWidth + 'px');
|
|
152
|
+
videoElement.css('height', preHeight + 'px');
|
|
153
|
+
videoElement.css('left', preLeft);
|
|
154
|
+
videoElement.css('top', preTop);
|
|
155
|
+
videoElement.css('z-index', '0');
|
|
156
|
+
isFullscreen = false;
|
|
196
157
|
}
|
|
197
158
|
});
|
|
198
159
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
[{"__symbolic":"module","version":4,"metadata":{"VideoElement":{"__symbolic":"class","extends":{"__symbolic":"reference","module":"../base/conditional-display-element","name":"ConditionalDisplayElement","line":15,"character":34},"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"error","message":"Could not resolve type","line":
|
|
1
|
+
[{"__symbolic":"module","version":4,"metadata":{"VideoElement":{"__symbolic":"class","extends":{"__symbolic":"reference","module":"../base/conditional-display-element","name":"ConditionalDisplayElement","line":15,"character":34},"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"error","message":"Could not resolve type","line":23,"character":25,"context":{"typeName":"HTMLElement"}},{"__symbolic":"reference","module":"@angular/core","name":"Injector","line":24,"character":18},{"__symbolic":"reference","module":"../../service","name":"PermissionChecker","line":25,"character":27},{"__symbolic":"reference","module":"../../communication","name":"VariableCommunicator","line":26,"character":30},{"__symbolic":"reference","module":"../../config","name":"VariableStore","line":27,"character":23},{"__symbolic":"reference","module":"../../service","name":"VideoService","line":28,"character":39},{"__symbolic":"reference","module":"../../model","name":"Size","line":29,"character":34},{"__symbolic":"reference","name":"string"},{"__symbolic":"reference","name":"string"}]}],"dispose":[{"__symbolic":"method"}],"hide":[{"__symbolic":"method"}],"show":[{"__symbolic":"method"}],"init":[{"__symbolic":"method"}],"initVideo":[{"__symbolic":"method"}],"addVideoAddressToolTip":[{"__symbolic":"method"}],"setAndroidVideo":[{"__symbolic":"method"}]}}}}]
|
|
@@ -170,6 +170,9 @@ export class ViewOperationElement extends ConditionalEnableElement {
|
|
|
170
170
|
const viewIndex = this.model.viewIndex;
|
|
171
171
|
if (null != viewIndex) {
|
|
172
172
|
this.popupViewService.popView(viewIndex, this.hostContainerId, this.el).subscribe(() => this.recordViewOperation(), error => this.logger.error(`ToggleView(${viewIndex}) failed. ${error}`));
|
|
173
|
+
$(`#${this.hostContainerId} video`)
|
|
174
|
+
.addClass('video-hidden')
|
|
175
|
+
.css('visibility', 'hidden');
|
|
173
176
|
}
|
|
174
177
|
else {
|
|
175
178
|
this.logger.error('[GUI]Toggle View:invalid view index');
|
|
@@ -177,6 +180,9 @@ export class ViewOperationElement extends ConditionalEnableElement {
|
|
|
177
180
|
}
|
|
178
181
|
closeView() {
|
|
179
182
|
this.popupViewService.closeView();
|
|
183
|
+
$(`#${this.hostContainerId} .video-hidden`)
|
|
184
|
+
.removeClass('video-hidden')
|
|
185
|
+
.css('visibility', 'visible');
|
|
180
186
|
this.recordViewOperation();
|
|
181
187
|
}
|
|
182
188
|
moveView(movementX, movementY) {
|