import React from "react"; import lbry from "lbry.js"; import lbryuri from "lbryuri.js"; import Video from "component/video"; import { Thumbnail } from "component/common"; import FilePrice from "component/filePrice"; import FileDetails from "component/fileDetails"; import UriIndicator from "component/uriIndicator"; import Icon from "component/icon"; import WalletSendTip from "component/walletSendTip"; import DateTime from "component/dateTime"; import * as icons from "constants/icons"; class FilePage extends React.PureComponent { componentDidMount() { this.fetchFileInfo(this.props); this.fetchCostInfo(this.props); } componentWillReceiveProps(nextProps) { this.fetchFileInfo(nextProps); } fetchFileInfo(props) { if (props.fileInfo === undefined) { props.fetchFileInfo(props.uri); } } fetchCostInfo(props) { if (props.costInfo === undefined) { props.fetchCostInfo(props.uri); } } render() { const { claim, fileInfo, metadata, contentType, tab, uri, rewardedContentClaimIds, } = this.props; const showTipBox = tab == "tip"; if (!claim || !metadata) { return ( {__("Empty claim or metadata info.")} ); } const { height } = claim; const title = metadata.title; const isRewardContent = rewardedContentClaimIds.includes(claim.claim_id); const mediaType = lbry.getMediaType(contentType); const player = require("render-media"); const obscureNsfw = this.props.obscureNsfw && metadata && metadata.nsfw; const isPlayable = Object.values(player.mime).indexOf(contentType) !== -1 || mediaType === "audio"; return (