Fix/BOOK-240 video fixes
* fix(BOOK-240): Added support for multiple sources and fixed issue with play/pause on mobile * fix(BOOK-240): Pausing hero video when scrolling out of view Approved-by: Christel Westerberg
This commit is contained in:
@@ -11,6 +11,7 @@ export const videoSchema = z.object({
|
||||
z.object({
|
||||
node: z.object({
|
||||
url: z.string().url(),
|
||||
content_type: z.string(),
|
||||
}),
|
||||
})
|
||||
),
|
||||
@@ -36,9 +37,13 @@ export const videoSchema = z.object({
|
||||
export const transformedVideoSchema = videoSchema
|
||||
.nullish()
|
||||
.transform((video) => {
|
||||
const src = video?.sourceConnection.edges[0]?.node.url || ""
|
||||
const sources =
|
||||
video?.sourceConnection.edges.map((edge) => ({
|
||||
src: edge.node.url,
|
||||
type: edge.node.content_type,
|
||||
})) || []
|
||||
|
||||
if (!video || !src) {
|
||||
if (!video || !sources.length) {
|
||||
return null
|
||||
}
|
||||
|
||||
@@ -51,7 +56,7 @@ export const transformedVideoSchema = videoSchema
|
||||
}))
|
||||
|
||||
return {
|
||||
src,
|
||||
sources,
|
||||
focalPoint: video.focal_point
|
||||
? { x: video.focal_point.x, y: video.focal_point.y }
|
||||
: { x: 50, y: 50 },
|
||||
|
||||
Reference in New Issue
Block a user