import React from 'react'; import FilePrice from 'component/filePrice' import Link from 'component/link'; import Modal from 'component/modal'; class VideoPlayButton extends React.Component { confirmPurchaseClick() { this.props.closeModal() this.props.startPlaying() this.props.loadVideo(this.props.uri) } render() { const { button, label, className, onWatchClick, metadata, metadata: { title, }, uri, modal, closeModal, isLoading, costInfo, fileInfo, } = this.props /* title={ isLoading ? "Video is Loading" : !costInfo ? "Waiting on cost info..." : fileInfo === undefined ? "Waiting on file info..." : "" } */ return (
{modal} You don't have enough LBRY credits to pay for this stream. Are you sure you'd like to buy {this.props.metadata.title} for credits? Sorry, your download timed out :(
); } } const plyr = require('plyr') class Video extends React.Component { constructor(props) { super(props) this.state = { isPlaying: false } } onWatchClick() { this.props.watchVideo(this.props.uri).then(() => { if (!this.props.modal) { this.setState({ isPlaying: true }) } }) } startPlaying() { this.setState({ isPlaying: true }) } render() { const { metadata, isLoading, isDownloading, fileInfo, } = this.props const { isPlaying = false, } = this.state let loadStatusMessage = '' if (isLoading) { loadStatusMessage = "Requesting stream... it may sit here for like 15-20 seconds in a really awkward way... we're working on it" } else if (isDownloading) { loadStatusMessage = "Downloading stream... not long left now!" } return (
{ isPlaying ? (!fileInfo.isReadyToPlay ? this is the world's worst loading screen and we shipped our software with it anyway...

{loadStatusMessage}
: ) :
}
); } } class VideoPlayer extends React.PureComponent { componentDidMount() { const elem = this.refs.video const { downloadPath, contentType, } = this.props const players = plyr.setup(elem) players[0].play() } render() { const { downloadPath, contentType, } = this.props return ( ) } } export default Video