Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Youtube VideoPreview with correct video duration formatting
/*...*/
import {getVideoDurationString} from '../../services/date/date-format';
export class VideoPreview extends React.Component {
render() {
/* ... */
const duration = video.contentDetails ? video.contentDetails.duration : null;
const videoDuration = getVideoDurationString(duration);
const viewAndTimeString = VideoPreview.getFormattedViewAndTime(video);
const horizontal = this.props.horizontal ? 'horizontal' : null;
return (
{/*...*/}
<div className='time-label'>
<span>{videoDuration}</span>
</div>
{/*... */}
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.