diff --git a/ui/js/actions/content.js b/ui/js/actions/content.js index a52634bca..e6b6a30a1 100644 --- a/ui/js/actions/content.js +++ b/ui/js/actions/content.js @@ -209,7 +209,7 @@ export function doLoadVideo(uri) { } } -export function doPurchaseUri(uri) { +export function doPurchaseUri(uri, purchaseModalName) { return function(dispatch, getState) { const state = getState() const balance = selectBalance(state) @@ -244,7 +244,7 @@ export function doPurchaseUri(uri) { if (cost > balance) { dispatch(doOpenModal('notEnoughCredits')) } else { - dispatch(doOpenModal('affirmPurchase')) + dispatch(doOpenModal(purchaseModalName)) } return Promise.resolve() diff --git a/ui/js/component/fileActions/index.js b/ui/js/component/fileActions/index.js index e9dc10705..8e9555a14 100644 --- a/ui/js/component/fileActions/index.js +++ b/ui/js/component/fileActions/index.js @@ -66,7 +66,7 @@ const perform = (dispatch) => ({ dispatch(doDeleteFile(fileInfo, deleteFromComputer)) }, openModal: (modal) => dispatch(doOpenModal(modal)), - startDownload: (uri) => dispatch(doPurchaseUri(uri)), + startDownload: (uri) => dispatch(doPurchaseUri(uri, 'affirmPurchase')), loadVideo: (uri) => dispatch(doLoadVideo(uri)), }) diff --git a/ui/js/component/video/index.js b/ui/js/component/video/index.js index 5566da840..423ff533a 100644 --- a/ui/js/component/video/index.js +++ b/ui/js/component/video/index.js @@ -47,7 +47,7 @@ const makeSelect = () => { const perform = (dispatch) => ({ loadVideo: (uri) => dispatch(doLoadVideo(uri)), - purchaseUri: (uri) => dispatch(doPurchaseUri(uri)), + purchaseUri: (uri) => dispatch(doPurchaseUri(uri, 'affirmPurchaseAndPlay')), closeModal: () => dispatch(doCloseModal()), }) diff --git a/ui/js/component/video/view.jsx b/ui/js/component/video/view.jsx index e29a9bff8..d7a1f274f 100644 --- a/ui/js/component/video/view.jsx +++ b/ui/js/component/video/view.jsx @@ -52,13 +52,12 @@ class VideoPlayButton extends React.Component { className="video__play-button" icon="icon-play" onClick={this.onWatchClick.bind(this)} /> - {modal} You don't have enough LBRY credits to pay for this stream. @@ -72,8 +71,6 @@ class VideoPlayButton extends React.Component { } } -const plyr = require('plyr') - class Video extends React.Component { constructor(props) { super(props) @@ -114,7 +111,7 @@ class Video extends React.Component { isPlaying || isLoading ? (!isReadyToPlay ? this is the world's worst loading screen and we shipped our software with it anyway...

{loadStatusMessage}
: - ) : + ) :
@@ -123,18 +120,28 @@ class Video extends React.Component { } } +const from = require('from2') +const player = require('render-media') +const fs = require('fs') + class VideoPlayer extends React.Component { componentDidMount() { const elem = this.refs.video const { - autoplay, downloadPath, contentType, + filename, } = this.props - const players = plyr.setup(elem) - if (autoplay) { - players[0].play() + const file = { + name: filename, + createReadStream: (opts) => { + return fs.createReadStream(downloadPath, opts) + } } + player.render(file, elem, { + autoplay: true, + controls: true, + }) } render() { @@ -145,7 +152,7 @@ class VideoPlayer extends React.Component { } = this.props return ( -