From 034a9400c5d52b5786deb443c157a806b9d41639 Mon Sep 17 00:00:00 2001 From: Mattermost Build Date: Sat, 15 Aug 2020 11:21:43 -0400 Subject: [PATCH] MM-27711 Play YouTube video using expanded link (#4666) (#4685) (cherry picked from commit d1d7b7f9d6c61c85e842bb2b587e9e38d4c2c5ca) Co-authored-by: Elias Nahum --- .../post_body_additional_content.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/app/components/post_body_additional_content/post_body_additional_content.js b/app/components/post_body_additional_content/post_body_additional_content.js index e104b4306..773b63280 100644 --- a/app/components/post_body_additional_content/post_body_additional_content.js +++ b/app/components/post_body_additional_content/post_body_additional_content.js @@ -238,9 +238,10 @@ export default class PostBodyAdditionalContent extends ImageViewPort { }; playYouTubeVideo = () => { - const {link} = this.props; - const videoId = getYouTubeVideoId(link); - const startTime = this.getYouTubeTime(link); + const {expandedLink, link} = this.props; + const videoLink = expandedLink || link; + const videoId = getYouTubeVideoId(videoLink); + const startTime = this.getYouTubeTime(videoLink); if (Platform.OS === 'ios') { YouTubeStandaloneIOS. @@ -258,7 +259,7 @@ export default class PostBodyAdditionalContent extends ImageViewPort { startTime, }).catch(this.playYouTubeVideoError); } else { - Linking.openURL(link); + Linking.openURL(videoLink); } } };