@flexem/fc-gui 3.0.0-alpha.59 → 3.0.0-alpha.60

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.
@@ -21,7 +21,6 @@ export declare class VideoElement extends ConditionalDisplayElement {
21
21
  hide(): void;
22
22
  show(): void;
23
23
  private init;
24
- private initVideo;
25
24
  private addVideoAddressToolTip;
26
25
  private setAndroidVideo;
27
26
  }
@@ -46,64 +46,63 @@ 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);
52
49
  this.videoService.getVideoUrl(this.model.videoTag).then(result => {
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;
50
+ const isAndroid = !!navigator.userAgent.match(/(Android)/i);
51
+ let videoUrl = result.url;
52
+ const patt = /https:.+.m3u8/;
53
+ if (videoUrl.indexOf('http:') !== -1) {
54
+ videoUrl = videoUrl.replace('http:', 'https:');
67
55
  }
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 ';
56
+ if (!patt.test(videoUrl)) {
57
+ let videoToolTip = this.localization.invalidVideoAddress;
58
+ if (isNil(videoUrl) || videoUrl === '') {
59
+ videoToolTip = this.localization.unconfiguredVideoAddress;
60
+ }
61
+ this.addVideoAddressToolTip(videoToolTip);
62
+ return;
63
+ }
64
+ const video = this.rootElement.append('foreignObject')
65
+ .attr('x', 0)
66
+ .attr('y', 0)
67
+ .attr('width', this.model.size.width)
68
+ .attr('height', this.model.size.height)
69
+ .append('xhtml:video')
70
+ .attr('id', this.videoId)
71
+ .attr('scareX', this.model.location.x / this.guiSize.width)
72
+ .attr('scareY', this.model.location.y / this.guiSize.height)
73
+ .attr('src', videoUrl)
74
+ .style('width', '100%')
75
+ .style('height', '100%')
76
+ .attr('playsInline', true)
77
+ .attr('webkit-playsinline', true);
78
+ if (this.isMobileMode) {
79
+ if (isAndroid) {
80
+ if (result.isMobileType) {
81
+ video.attr('controls', true);
82
+ }
83
+ video.attr('autoplay', true);
84
+ video.attr('muted', true);
85
+ }
86
+ else {
87
+ video.attr('controls', true);
88
+ video.attr('muted', true);
89
89
  }
90
- videoHtml += ' autoplay muted></video>';
91
90
  }
92
91
  else {
93
- videoHtml += ' controls muted></video>';
92
+ video.attr('controls', true);
93
+ video.attr('autoplay', true);
94
+ video.attr('muted', true);
94
95
  }
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
- }
96
+ if (this.isShow === false) {
97
+ $('#' + this.videoId).hide();
98
+ }
99
+ this.videoPlayer = new EZUIPlayer(this.videoId);
100
+ if (isAndroid && !result.isMobileType) {
101
+ this.setAndroidVideo(this.videoId);
102
+ }
103
+ }).catch(() => {
104
+ throw new Error('Failure of the videoService');
105
+ });
107
106
  }
108
107
  addVideoAddressToolTip(videoToolTip) {
109
108
  const size = this.model.size;
@@ -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":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"}]}}}}]
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"}],"addVideoAddressToolTip":[{"__symbolic":"method"}],"setAndroidVideo":[{"__symbolic":"method"}]}}}}]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "main": "bundles/fc-gui.umd.js",
3
- "version": "3.0.0-alpha.59",
3
+ "version": "3.0.0-alpha.60",
4
4
  "module": "public_api.js",
5
5
  "typings": "public_api.d.ts",
6
6
  "license": "UNLICENSED",