Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Media type specific player #842

Merged
merged 1 commit into from
Jul 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ const EventDetailsAssetMediaDetails = ({
const media = useAppSelector(state => getAssetMediaDetails(state));
const isFetching = useAppSelector(state => isFetchingAssetMediaDetails(state));

const PlayerType = media.has_video ? 'video' : 'audio';

const videoRef = useRef<HTMLVideoElement>(null);

// Make sure to reload the video player when the url changes, React will not do that for us
Expand Down Expand Up @@ -364,24 +366,26 @@ const EventDetailsAssetMediaDetails = ({
</div>
</div>

{/* preview video player */}
<div className="obj tbl-container media-stream-details">
<header>
{t("EVENTS.EVENTS.DETAILS.ASSETS.PREVIEW") /* Preview */}
</header>
<div className="obj-container">
<div>
{/* video player */}
<div className="video-player">
<div>
<video ref={videoRef} id="player" controls>
<source src={media.url} type={media.mimetype}/>
</video>
{/* preview video/audio player (only if we actually have video/audio) */}
{(media.has_video || media.has_audio) && (
<div className="obj tbl-container media-stream-details">
<header>
{t("EVENTS.EVENTS.DETAILS.ASSETS.PREVIEW") /* Preview */}
</header>
<div className="obj-container">
<div>
{/* video player */}
<div className="video-player">
<div>
<PlayerType ref={videoRef} id="player" controls>
<source src={media.url} type={media.mimetype}/>
</PlayerType>
</div>
</div>
</div>
</div>
</div>
</div>
)}
</div>
</div>
</div>
Expand Down
Loading