import React from 'react'; import lbry from '../lbry.js'; import lighthouse from '../lighthouse.js'; import uri from '../uri.js'; import {Video} from '../page/watch.js' import {TruncatedText, Thumbnail, FilePrice, BusyMessage} from '../component/common.js'; import {FileActions} from '../component/file-actions.js'; import {Link} from '../component/link.js'; import UriIndicator from '../component/channel-indicator.js'; var FormatItem = React.createClass({ propTypes: { metadata: React.PropTypes.object, contentType: React.PropTypes.string, uri: React.PropTypes.string, outpoint: React.PropTypes.string, }, render: function() { const {thumbnail, author, title, description, language, license} = this.props.metadata; const mediaType = lbry.getMediaType(this.props.contentType); return (
Content-Type{this.props.contentType}
Author{author}
Language{language}
License{license}
); } }); let ShowPage = React.createClass({ _uri: null, propTypes: { uri: React.PropTypes.string, }, getInitialState: function() { return { metadata: null, contentType: null, hasSignature: false, signatureIsValid: false, cost: null, costIncludesData: null, uriLookupComplete: null, }; }, componentWillMount: function() { this._uri = uri.normalizeLbryUri(this.props.uri); document.title = this._uri; lbry.resolve({uri: this._uri}).then(({ claim: {txid, nout, has_signature, signature_is_valid, value: {stream: {metadata, source: {contentType}}}}}) => { this.setState({ outpoint: txid + ':' + nout, metadata: metadata, hasSignature: has_signature, signatureIsValid: signature_is_valid, contentType: contentType, uriLookupComplete: true, }); }); lbry.getCostInfo(this._uri).then(({cost, includesData}) => { this.setState({ cost: cost, costIncludesData: includesData, }); }); }, render: function() { const metadata = this.state.uriLookupComplete ? this.state.metadata : null, title = this.state.uriLookupComplete ? metadata.title : this._uri; console.log(metadata); return (
{ this.state.contentType && this.state.contentType.startsWith('video/') ?

{title}

{ this.state.uriLookupComplete ?
: '' }
{ this.state.uriLookupComplete ?
{metadata.description}
:
}
{ metadata ?
: '' }
); } }); export default ShowPage;