diff options
author | AymaneKhouaji <akhouaji@linagora.com> | 2017-02-07 07:25:08 +0100 |
---|---|---|
committer | Joram Wilander <jwawilander@gmail.com> | 2017-02-06 22:25:08 -0800 |
commit | 17d1ed114c78e77d3608929873d49e95f03368a7 (patch) | |
tree | 46c31cac2fe2e20dec8f5e68d75626fe03023198 | |
parent | 233f43e47fd84c56b434a956ec43a6b0483126c9 (diff) | |
download | chat-17d1ed114c78e77d3608929873d49e95f03368a7.tar.gz chat-17d1ed114c78e77d3608929873d49e95f03368a7.tar.bz2 chat-17d1ed114c78e77d3608929873d49e95f03368a7.zip |
Support all timecode formats for YouTube preview (#4957) (#5032)
-rw-r--r-- | webapp/components/youtube_video.jsx | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/webapp/components/youtube_video.jsx b/webapp/components/youtube_video.jsx index 908a2c74e..7b7133af3 100644 --- a/webapp/components/youtube_video.jsx +++ b/webapp/components/youtube_video.jsx @@ -57,16 +57,16 @@ export default class YoutubeVideo extends React.Component { } handleYoutubeTime(link) { - const timeRegex = /[\\?&]t=([0-9hms]+)/; + const timeRegex = /[\\?&]t=([0-9]+h)?([0-9]+m)?([0-9]+s?)/; const time = link.match(timeRegex); - if (!time || !time[1]) { + if (!time || !time[0]) { return ''; } - const hours = time[1].match(/([0-9]+)h/); - const minutes = time[1].match(/([0-9]+)m/); - const seconds = time[1].match(/([0-9]+)s/); + const hours = time[1] ? time[1].match(/([0-9]+)h/) : null; + const minutes = time[2] ? time[2].match(/([0-9]+)m/) : null; + const seconds = time[3] ? time[3].match(/([0-9]+)s?/) : null; let ticks = 0; |