lbry-desktop/ui/component/videoDuration/view.jsx

23 lines
551 B
React
Raw Permalink Normal View History

2019-06-27 22:27:38 +02:00
// @flow
import React from 'react';
import formatMediaDuration from 'util/formatMediaDuration';
2019-06-27 22:27:38 +02:00
type Props = {
claim: ?StreamClaim,
className?: string,
};
function VideoDuration(props: Props) {
const { claim, className } = props;
const media = claim && claim.value && (claim.value.video || claim.value.audio);
2019-06-27 22:27:38 +02:00
let duration;
if (media && media.duration) {
2019-06-27 22:27:38 +02:00
// $FlowFixMe
duration = formatMediaDuration(media.duration);
2019-06-27 22:27:38 +02:00
}
return duration ? <span className={className}>{duration}</span> : null;
}
export default VideoDuration;