import React from 'react'; import { Icon, Thumbnail, } from 'component/common'; import FilePrice from 'component/filePrice' import Link from 'component/link'; import Modal from 'component/modal'; class WatchLink extends React.Component { confirmPurchaseClick() { this.props.closeModal() this.props.startPlaying() this.props.loadVideo() } render() { const { button, label, className, onWatchClick, metadata, metadata: { title, }, uri, modal, closeModal, isLoading, costInfo, fileInfo, } = this.props 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().then(() => { if (!this.props.modal) { this.setState({ isPlaying: true }) } }) } startPlaying() { this.setState({ isPlaying: true }) } render() { const { readyToPlay = false, thumbnail, 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 ? !readyToPlay ? 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