Skip to content

Commit

Permalink
Merge branch 'develop' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
aniku777tw committed Dec 14, 2023
2 parents 43e4ce2 + 3171b24 commit a2b6ac2
Showing 1 changed file with 24 additions and 25 deletions.
49 changes: 24 additions & 25 deletions src/components/library/VideoLibraryItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -134,32 +134,31 @@ export const PreviewButton: React.VFC<
},
})
.then(({ data }) => {
const { signedVideoUrl, signedCaptionUrl, cloudfrontOptions, captionPaths } = data.result
const videoSearch = new URL(signedVideoUrl).search
const captionSearch = new URL(signedCaptionUrl).search
const hlsPath = cloudfrontOptions?.playPaths ? new URL(cloudfrontOptions.playPaths.hls).pathname : null
const dashPath = cloudfrontOptions?.playPaths ? new URL(cloudfrontOptions.playPaths.dash).pathname : null
const cloudfrontMigratedHlsPath = cloudfrontOptions?.path ? new URL(cloudfrontOptions.path).pathname : null
const source = cloudfrontOptions?.playPaths
? [
{
type: 'application/x-mpegURL',
src: `${process.env.REACT_APP_LODESTAR_SERVER_ENDPOINT}/videos${hlsPath}${videoSearch}`,
},
{
type: 'application/dash+xml',
src: `${process.env.REACT_APP_LODESTAR_SERVER_ENDPOINT}/videos${dashPath}${videoSearch}`,
},
]
: [
{
type: 'application/x-mpegURL',
src: `${process.env.REACT_APP_LODESTAR_SERVER_ENDPOINT}/videos${cloudfrontMigratedHlsPath}${videoSearch}`,
},
]
const captions = captionPaths?.map((captionUrl: string) => `${captionUrl}${captionSearch}`)
const {
videoSignedPaths: { hlsPath, dashPath, cloudfrontMigratedHlsPath },
captionSignedUrls,
} = data.result

const source =
hlsPath && dashPath
? [
{
type: 'application/x-mpegURL',
src: `${process.env.REACT_APP_LODESTAR_SERVER_ENDPOINT}/videos${hlsPath}&token=${authToken}`,
},
{
type: 'application/dash+xml',
src: `${process.env.REACT_APP_LODESTAR_SERVER_ENDPOINT}/videos${dashPath}&token=${authToken}`,
},
]
: [
{
type: 'application/x-mpegURL',
src: `${process.env.REACT_APP_LODESTAR_SERVER_ENDPOINT}/videos${cloudfrontMigratedHlsPath}&token=${authToken}`,
},
]
setSources(source)
setCaptions(captions)
setCaptions(captionSignedUrls)
})
.catch(error => console.log(error))
.finally(() => setLoading(false))
Expand Down

0 comments on commit a2b6ac2

Please sign in to comment.