import React from 'react'; import superagent from 'superagent'; import { Accordion, Segment, Grid, Header, Form, Image, Label } from 'semantic-ui-react' export default class MediaItemInfoPanel extends React.Component { constructor(props) { super(props); this.state = { loading: false, cdnInfo: null }; } async componentDidMount() { return this.loadCDNInfo(); } async loadCDNInfo() { if (this.props.mediaItem.cdn && this.props.mediaItem.cdnId) { this.setState({ cdnInfo: null, loading: true }); try { const res = await superagent.get(`/api/admin/media/cdn/${this.props.mediaItem.cdn}/${this.props.mediaItem.cdnId}`).accept('json'); this.setState({ cdnInfo: res.body, loading: false }); } catch (e) { console.log(e); this.setState({ loading: false }); } } } render() { if (!this.props.mediaItem) { return
; } let cdnInfo = ( ) if (this.state.cdnInfo && this.state.cdnInfo.brightcove) { const brightcove = this.state.cdnInfo.brightcove; cdnInfo = (Created At: {brightcove.created_at}
Name: {brightcove.name}
State: {brightcove.state}
Duration: {brightcove.duration ? (brightcove.duration / 1000.0) : 0} seconds
Original Filename: {brightcove.original_filename}
Name: {bigscreen.name}
Title: {this.props.mediaItem.title}
Type:
Stereo: {this.props.mediaItem.isStereo && }
Stereo width: