@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.
@@ -29894,64 +29894,63 @@ class video_element_VideoElement extends conditional_display_element_Conditional
29894
29894
  return;
29895
29895
  }
29896
29896
  this.videoId = guid["a" /* Guid */].newGuid().toString('n');
29897
- this.rootElement.append('rect').attr('id', 'rect' + this.videoId).attr('fill', 'transparent')
29898
- .attr('width', this.model.size.width)
29899
- .attr('height', this.model.size.height);
29900
29897
  this.videoService.getVideoUrl(this.model.videoTag).then(result => {
29901
- this.initVideo(result.url, result.isMobileType, this.videoId);
29902
- }).catch(() => {
29903
- throw new Error('Failure of the videoService');
29904
- });
29905
- }
29906
- initVideo(videoUrl, isMobileType, videoId) {
29907
- const patt = /https:.+.m3u8/;
29908
- if (videoUrl.indexOf('http:') !== -1) {
29909
- videoUrl = videoUrl.replace('http:', 'https:');
29910
- }
29911
- if (!patt.test(videoUrl)) {
29912
- let videoToolTip = this.localization.invalidVideoAddress;
29913
- if (Object(lodash["isNil"])(videoUrl) || videoUrl === '') {
29914
- videoToolTip = this.localization.unconfiguredVideoAddress;
29898
+ const isAndroid = !!navigator.userAgent.match(/(Android)/i);
29899
+ let videoUrl = result.url;
29900
+ const patt = /https:.+.m3u8/;
29901
+ if (videoUrl.indexOf('http:') !== -1) {
29902
+ videoUrl = videoUrl.replace('http:', 'https:');
29915
29903
  }
29916
- this.addVideoAddressToolTip(videoToolTip);
29917
- return;
29918
- }
29919
- const currentRect = this.$element.find('rect#rect' + videoId).first();
29920
- if (!currentRect.length) {
29921
- return;
29922
- }
29923
- const clientRect = currentRect[0].getBoundingClientRect();
29924
- const chartWidth = clientRect.width;
29925
- const chartHeight = clientRect.height;
29926
- const left = this.model.location.x / this.guiSize.width * $('.' + this.svgRootClass).find('.svg-content').width();
29927
- const top = this.model.location.y / this.guiSize.height * $('.' + this.svgRootClass).find('.svg-content').height();
29928
- let videoHtml = `<video scareX="${this.model.location.x / this.guiSize.width}"
29929
- scareY="${this.model.location.y / this.guiSize.height}" id="${videoId}" src="${videoUrl}" style="
29930
- position: absolute;top:${top}px;left:${left}px;width:${chartWidth}px;height:${chartHeight}px;object-fit:fill;z-index:0"
29931
- playsInline webkit-playsinline `;
29932
- const isAndroid = !!navigator.userAgent.match(/(Android)/i);
29933
- if (this.isMobileMode) {
29934
- if (isAndroid) {
29935
- if (isMobileType) {
29936
- videoHtml += ' controls ';
29904
+ if (!patt.test(videoUrl)) {
29905
+ let videoToolTip = this.localization.invalidVideoAddress;
29906
+ if (Object(lodash["isNil"])(videoUrl) || videoUrl === '') {
29907
+ videoToolTip = this.localization.unconfiguredVideoAddress;
29908
+ }
29909
+ this.addVideoAddressToolTip(videoToolTip);
29910
+ return;
29911
+ }
29912
+ const video = this.rootElement.append('foreignObject')
29913
+ .attr('x', 0)
29914
+ .attr('y', 0)
29915
+ .attr('width', this.model.size.width)
29916
+ .attr('height', this.model.size.height)
29917
+ .append('xhtml:video')
29918
+ .attr('id', this.videoId)
29919
+ .attr('scareX', this.model.location.x / this.guiSize.width)
29920
+ .attr('scareY', this.model.location.y / this.guiSize.height)
29921
+ .attr('src', videoUrl)
29922
+ .style('width', '100%')
29923
+ .style('height', '100%')
29924
+ .attr('playsInline', true)
29925
+ .attr('webkit-playsinline', true);
29926
+ if (this.isMobileMode) {
29927
+ if (isAndroid) {
29928
+ if (result.isMobileType) {
29929
+ video.attr('controls', true);
29930
+ }
29931
+ video.attr('autoplay', true);
29932
+ video.attr('muted', true);
29933
+ }
29934
+ else {
29935
+ video.attr('controls', true);
29936
+ video.attr('muted', true);
29937
29937
  }
29938
- videoHtml += ' autoplay muted></video>';
29939
29938
  }
29940
29939
  else {
29941
- videoHtml += ' controls muted></video>';
29940
+ video.attr('controls', true);
29941
+ video.attr('autoplay', true);
29942
+ video.attr('muted', true);
29942
29943
  }
29943
- }
29944
- else {
29945
- videoHtml += ' controls autoplay muted></video>';
29946
- }
29947
- $('.' + this.svgRootClass).find('.svg-content').append(videoHtml);
29948
- if (this.isShow === false) {
29949
- $('#' + this.videoId).hide();
29950
- }
29951
- this.videoPlayer = new EZUIPlayer(videoId);
29952
- if (isAndroid && !isMobileType) {
29953
- this.setAndroidVideo(videoId);
29954
- }
29944
+ if (this.isShow === false) {
29945
+ $('#' + this.videoId).hide();
29946
+ }
29947
+ this.videoPlayer = new EZUIPlayer(this.videoId);
29948
+ if (isAndroid && !result.isMobileType) {
29949
+ this.setAndroidVideo(this.videoId);
29950
+ }
29951
+ }).catch(() => {
29952
+ throw new Error('Failure of the videoService');
29953
+ });
29955
29954
  }
29956
29955
  addVideoAddressToolTip(videoToolTip) {
29957
29956
  const size = this.model.size;