From a349fe5d19433c0000137ae4063f13dd08104960 Mon Sep 17 00:00:00 2001 From: juliabrzvtex <160511363+juliabrzvtex@users.noreply.github.com> Date: Tue, 4 Feb 2025 14:55:37 -0300 Subject: [PATCH] update extractVideoID function to recognize url in shorts format --- .../ProductImages/components/Video/Youtube.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/react/components/ProductImages/components/Video/Youtube.js b/react/components/ProductImages/components/Video/Youtube.js index 1c412eb3a..b731b0a81 100644 --- a/react/components/ProductImages/components/Video/Youtube.js +++ b/react/components/ProductImages/components/Video/Youtube.js @@ -25,15 +25,15 @@ class Youtube extends Component { static extractVideoID = url => { const regExp = - /^.*((youtu.be\/)|(v\/)|(\/u\/\w\/)|(embed\/)|(watch\?))\??v?=?([^#&?]*).*/ - + /^.*((youtu.be\/)|(v\/)|(\/u\/\w\/)|(embed\/)|(watch\?)|(shorts\/))\??v?=?([^#&?]*).*/ + const match = url.match(regExp) - - if (match && match[7].length === 11) return match[7] - + + if (match && match[8].length === 11) return match[8] + return null } - + executeCommand = command => () => { if (!this.frameReady) return