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