diff --git a/src/app/_modules/pages/sections/types/basic/video/video-section.component.html b/src/app/_modules/pages/sections/types/basic/video/video-section.component.html index fc24ac4..8071151 100644 --- a/src/app/_modules/pages/sections/types/basic/video/video-section.component.html +++ b/src/app/_modules/pages/sections/types/basic/video/video-section.component.html @@ -1,5 +1,12 @@ - + +
+ + + +
\ No newline at end of file diff --git a/src/app/_modules/pages/sections/types/basic/video/video-section.component.scss b/src/app/_modules/pages/sections/types/basic/video/video-section.component.scss index abeebdf..e69de29 100644 --- a/src/app/_modules/pages/sections/types/basic/video/video-section.component.scss +++ b/src/app/_modules/pages/sections/types/basic/video/video-section.component.scss @@ -1,6 +0,0 @@ -iframe { - width: 100%; - max-width: 720px; - min-height: 400px; - height: 100%; -} diff --git a/src/app/_modules/pages/sections/types/basic/video/video-section.component.ts b/src/app/_modules/pages/sections/types/basic/video/video-section.component.ts index d64b99b..29a5088 100644 --- a/src/app/_modules/pages/sections/types/basic/video/video-section.component.ts +++ b/src/app/_modules/pages/sections/types/basic/video/video-section.component.ts @@ -17,27 +17,38 @@ export class VideoSectionComponent { } public url:any = ''; + public source:string; + public videoID:string; + public poster:string; + public start = false; ngOnInit() { - const url = this.parsedUrl(this.objectsService.getValue(this.section, 'video-url')); - this.url = this.sanitizer.bypassSecurityTrustResourceUrl(url); + const URL = this.parsedUrl(this.objectsService.getValue(this.section, 'video-url')); + this.url = this.sanitizer.bypassSecurityTrustResourceUrl(URL); } parsedUrl(url: any) { let res = ''; - let videoId = ''; if (/https:\/\/youtu.be\//.test(url)) { - videoId = url.replace('https://youtu.be/',''); - res = 'https://www.youtube.com/embed/' + videoId; + this.videoID = url.replace('https://youtu.be/','').replace(/\?.*/,''); + this.source = 'youtube.com'; + res = 'https://www.youtube.com/embed/' + this.videoID + '?autoplay=1'; } else if (/https:\/\/www\.youtube\.com\/watch\?v\=/.test(url)) { - videoId = url.replace('https://www.youtube.com/watch?v=',''); - res = 'https://www.youtube.com/embed/' + videoId; + this.videoID = url.replace('https://www.youtube.com/watch?v=','').replace(/\?.*/,''); + this.source = 'youtube.com'; + res = 'https://www.youtube.com/embed/' + this.videoID + '?autoplay=1'; } else if (/https:\/\/rutube.ru\/video\//.test(url)) { - videoId = url.replace('https://rutube.ru/video/',''); - res = 'https://rutube.ru/play/embed/' + videoId; + this.videoID = url.replace('https://rutube.ru/video/',''); + this.source = 'rutube.ru'; + this.start = true; + res = 'https://rutube.ru/play/embed/' + this.videoID; } else { + this.start = true; res = url; } + if (this.source == 'youtube.com') { + this.poster = 'https://img.youtube.com/vi/' + this.videoID + '/hqdefault.jpg' + } return res; } } diff --git a/src/assets/css/_pages-section.scss b/src/assets/css/_pages-section.scss index 4c6805f..6d95ea7 100644 --- a/src/assets/css/_pages-section.scss +++ b/src/assets/css/_pages-section.scss @@ -354,4 +354,35 @@ gellery{ width: 100%; height: 100%; } +} + + +video-section{ + .video-box{ + max-width: 720px; + height: 400px; + position: relative; + img{ + cursor:pointer + } + .poster{ + object-fit: cover; + width: 100%; + height: 100%; + } + .icon{ + position: absolute; + left: 0; + right: 0; + top: 0; + bottom: 0; + margin: auto; + } + iframe{ + width: 100%; + height: 100%; + background-color: black; + } + } + } \ No newline at end of file diff --git a/src/assets/images/ico/video_play_60.svg b/src/assets/images/ico/video_play_60.svg new file mode 100644 index 0000000..08c172f --- /dev/null +++ b/src/assets/images/ico/video_play_60.svg @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/vniigaz-v2/css/_pages-section.scss b/src/vniigaz-v2/css/_pages-section.scss index 538bbad..b2a46ef 100644 --- a/src/vniigaz-v2/css/_pages-section.scss +++ b/src/vniigaz-v2/css/_pages-section.scss @@ -421,4 +421,34 @@ gellery{ width: 100%; height: 100%; } +} + +video-section{ + .video-box{ + max-width: 720px; + height: 400px; + position: relative; + img{ + cursor:pointer + } + .poster{ + object-fit: cover; + width: 100%; + height: 100%; + } + .icon{ + position: absolute; + left: 0; + right: 0; + top: 0; + bottom: 0; + margin: auto; + } + iframe{ + width: 100%; + height: 100%; + background-color: black; + } + } + } \ No newline at end of file diff --git a/src/vniigaz-v2/images/ico/video_play_60.svg b/src/vniigaz-v2/images/ico/video_play_60.svg new file mode 100644 index 0000000..08c172f --- /dev/null +++ b/src/vniigaz-v2/images/ico/video_play_60.svg @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file