Fix embed view with search params
authorChocobozzz <me@florianbigard.com>
Thu, 7 Jun 2018 13:03:33 +0000 (15:03 +0200)
committerChocobozzz <me@florianbigard.com>
Thu, 7 Jun 2018 13:03:33 +0000 (15:03 +0200)
client/src/standalone/videos/embed.ts

index 1660132264f86c91a3db2b90d35eeb26f0594f7b..4f6fae8aa2c839f72bc7a89be1293a38e920819e 100644 (file)
@@ -59,7 +59,8 @@ function videoFetchError (videoElement: HTMLVideoElement) {
 }
 
 const urlParts = window.location.href.split('/')
-const videoId = urlParts[urlParts.length - 1]
+const lastPart = urlParts[urlParts.length - 1]
+const videoId = lastPart.indexOf('?') === -1 ? lastPart : lastPart.split('?')[0]
 
 loadLocale(environment.apiUrl, videojs, navigator.language)
   .then(() => loadVideoInfo(videoId))