mirror of
https://github.com/LemmyNet/lemmy-ui.git
synced 2024-11-01 01:59:56 +00:00
parent
8c68ee450e
commit
2fdd42087a
1 changed files with 25 additions and 9 deletions
|
@ -187,6 +187,7 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
|
|||
{this.showBody && post.url && post.embed_title && (
|
||||
<MetadataCard post={post} />
|
||||
)}
|
||||
{this.showBody && this.videoBlock}
|
||||
{this.showBody && this.body()}
|
||||
</>
|
||||
) : (
|
||||
|
@ -238,29 +239,44 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
|
|||
</div>
|
||||
);
|
||||
}
|
||||
get img() {
|
||||
const { post } = this.postView;
|
||||
const { url } = post;
|
||||
|
||||
if (this.isoData.showAdultConsentModal) {
|
||||
return <></>;
|
||||
}
|
||||
get videoBlock() {
|
||||
const post = this.postView.post;
|
||||
const url = post.url;
|
||||
|
||||
// if direct video link or embedded video link
|
||||
if (url && (isVideo(url) || post.embed_video_url)) {
|
||||
if (url && isVideo(url)) {
|
||||
return (
|
||||
<div className="embed-responsive ratio ratio-16x9 mt-3">
|
||||
<div className="ratio ratio-16x9 mt-3">
|
||||
<video
|
||||
onLoadStart={linkEvent(this, this.handleVideoLoadStart)}
|
||||
onPlay={linkEvent(this, this.handleVideoLoadStart)}
|
||||
onVolumeChange={linkEvent(this, this.handleVideoVolumeChange)}
|
||||
controls
|
||||
className="embed-responsive-item col-12"
|
||||
>
|
||||
<source src={post.embed_video_url ?? url} type="video/mp4" />
|
||||
</video>
|
||||
</div>
|
||||
);
|
||||
} else if (post.embed_video_url) {
|
||||
return (
|
||||
<div className="ratio ratio-16x9 mt-3">
|
||||
<iframe
|
||||
title="video embed"
|
||||
src={post.embed_video_url}
|
||||
sandbox="allow-same-origin allow-scripts"
|
||||
allowFullScreen={true}
|
||||
></iframe>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
get img() {
|
||||
const { post } = this.postView;
|
||||
|
||||
if (this.isoData.showAdultConsentModal) {
|
||||
return <></>;
|
||||
}
|
||||
|
||||
if (this.imageSrc) {
|
||||
|
|
Loading…
Reference in a new issue