2019-06-27 22:27:38 +02:00
|
|
|
// @flow
|
|
|
|
import React from 'react';
|
2021-07-16 01:12:11 +02:00
|
|
|
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;
|
|
|
|
|
2021-07-16 01:12:11 +02:00
|
|
|
const media = claim && claim.value && (claim.value.video || claim.value.audio);
|
2019-06-27 22:27:38 +02:00
|
|
|
let duration;
|
2021-07-16 01:12:11 +02:00
|
|
|
if (media && media.duration) {
|
2019-06-27 22:27:38 +02:00
|
|
|
// $FlowFixMe
|
2021-07-16 01:12:11 +02:00
|
|
|
duration = formatMediaDuration(media.duration);
|
2019-06-27 22:27:38 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return duration ? <span className={className}>{duration}</span> : null;
|
|
|
|
}
|
|
|
|
|
|
|
|
export default VideoDuration;
|