- {this.props.contentType && this.props.contentType.startsWith('video/')
- ?
- : null}
{this.state.fileInfo !== null || this.state.fileInfo.isMine
? linkBlock
: null}
diff --git a/ui/js/main.js b/ui/js/main.js
index 9d11107d0..d31b4c7d5 100644
--- a/ui/js/main.js
+++ b/ui/js/main.js
@@ -30,6 +30,7 @@ let init = function() {
function onDaemonReady() {
window.sessionStorage.setItem('loaded', 'y'); //once we've made it here once per session, we don't need to show splash again
+ //
ReactDOM.render(
, canvas)
}
diff --git a/ui/js/page/publish.js b/ui/js/page/publish.js
index 9267550c9..90dbe4504 100644
--- a/ui/js/page/publish.js
+++ b/ui/js/page/publish.js
@@ -19,7 +19,7 @@ var PublishPage = React.createClass({
return;
}
else {
- // rewards.claimReward(rewards.TYPE_FIRST_PUBLISH)
+ rewards.claimReward(rewards.TYPE_FIRST_PUBLISH)
}
});
},
@@ -27,7 +27,7 @@ var PublishPage = React.createClass({
// Calls API to update displayed list of channels. If a channel name is provided, will select
// that channel at the same time (used immediately after creating a channel)
lbry.channel_list_mine().then((channels) => {
- // rewards.claimReward(rewards.TYPE_FIRST_CHANNEL)
+ rewards.claimReward(rewards.TYPE_FIRST_CHANNEL)
this.setState({
channels: channels,
... channel ? {channel} : {}
diff --git a/ui/js/page/show.js b/ui/js/page/show.js
index f3b361976..c22dfdeee 100644
--- a/ui/js/page/show.js
+++ b/ui/js/page/show.js
@@ -62,7 +62,6 @@ let ShowPage = React.createClass({
document.title = this._uri;
lbry.resolve({uri: this._uri}).then(({ claim: {txid, nout, has_signature, signature_is_valid, value: {stream: {metadata, source: {contentType}}}}}) => {
- console.log({txid, nout, claim: {value: {stream: {metadata, source: {contentType}}}}} );
this.setState({
outpoint: txid + ':' + nout,
metadata: metadata,
@@ -86,17 +85,15 @@ let ShowPage = React.createClass({
}
//
-
const
metadata = this.state.uriLookupComplete ? this.state.metadata : null,
title = this.state.uriLookupComplete ? metadata.title : this._uri;
- console.log(metadata);
return (
- { this.props.contentType && this.props.contentType.startsWith('video/') ?
- :
+ { this.state.contentType && this.state.contentType.startsWith('video/') ?
+ :
}
diff --git a/ui/js/page/watch.js b/ui/js/page/watch.js
index 45341ded1..bd80c30b2 100644
--- a/ui/js/page/watch.js
+++ b/ui/js/page/watch.js
@@ -1,5 +1,5 @@
import React from 'react';
-import {Icon} from '../component/common.js';
+import {Icon, Thumbnail} from '../component/common.js';
import {Link} from '../component/link.js';
import lbry from '../lbry.js';
import LoadScreen from '../component/load_screen.js'
@@ -20,16 +20,41 @@ export let Video = React.createClass({
return {
downloadStarted: false,
readyToPlay: false,
- loadStatusMessage: "Requesting stream",
+ isPlaying: false,
+ isPurchased: false,
+ loadStatusMessage: "Requesting stream... it may sit here for like 15-20 seconds in a really awkward way... we're working on it",
mimeType: null,
controlsShown: false,
};
},
- componentDidMount: function() {
+ start: function() {
+ // lbry.getCostInfo(this.props.uri).then(({cost}) => {
+ // lbry.getBalance((balance) => {
+ // if (cost > balance) {
+ // this.setState({
+ // modal: 'notEnoughCredits',
+ // loading: false,
+ // });
+ // } else {
+ // this.startVideo();
+ // }
+ // });
+ // // });
+ //
+ // You don't have enough LBRY credits to pay for this stream.
+ //
lbry.get({uri: this.props.uri}).then((fileInfo) => {
this._outpoint = fileInfo.outpoint;
this.updateLoadStatus();
});
+ this.setState({
+ isPlaying: true
+ })
+ },
+ componentDidMount: function() {
+ if (this.props.autoplay) {
+ this.start()
+ }
},
handleMouseMove: function() {
if (this._controlsTimeout) {
@@ -81,7 +106,6 @@ export let Video = React.createClass({
readyToPlay: true,
mimeType: status.mime_type,
})
- return
const mediaFile = {
createReadStream: function (opts) {
// Return a readable stream that provides the bytes
@@ -98,128 +122,16 @@ export let Video = React.createClass({
},
render: function() {
return (
-
{
- !this.state.readyToPlay || true ?
- this is the world's world loading message and we shipped our software with it anyway... seriously it is actually loading... it might take a while though :
-
+
{
+ this.state.isPlaying ?
+ !this.state.readyToPlay ?
+ this is the world's world loading screen and we shipped our software with it anyway...
{this.state.loadStatusMessage} :
+ :
+
+
+
+
}
);
}
})
-
-var WatchPage = React.createClass({
- _isMounted: false,
- _controlsHideDelay: 3000, // Note: this needs to be shorter than the built-in delay in Electron, or Electron will hide the controls before us
- _controlsHideTimeout: null,
- _outpoint: null,
-
- propTypes: {
- uri: React.PropTypes.string,
- },
- getInitialState: function() {
- return {
- downloadStarted: false,
- readyToPlay: false,
- loadStatusMessage: "Requesting stream",
- mimeType: null,
- controlsShown: false,
- };
- },
- componentDidMount: function() {
- lbry.get({uri: this.props.uri}).then((fileInfo) => {
- this._outpoint = fileInfo.outpoint;
- this.updateLoadStatus();
- });
- },
- handleBackClicked: function() {
- history.back();
- },
- handleMouseMove: function() {
- if (this._controlsTimeout) {
- clearTimeout(this._controlsTimeout);
- }
-
- if (!this.state.controlsShown) {
- this.setState({
- controlsShown: true,
- });
- }
- this._controlsTimeout = setTimeout(() => {
- if (!this.isMounted) {
- return;
- }
-
- this.setState({
- controlsShown: false,
- });
- }, this._controlsHideDelay);
- },
- handleMouseLeave: function() {
- if (this._controlsTimeout) {
- clearTimeout(this._controlsTimeout);
- }
-
- if (this.state.controlsShown) {
- this.setState({
- controlsShown: false,
- });
- }
- },
- updateLoadStatus: function() {
- lbry.file_list({
- outpoint: this._outpoint,
- full_status: true,
- }).then(([status]) => {
- if (!status || status.written_bytes == 0) {
- // Download hasn't started yet, so update status message (if available) then try again
- // TODO: Would be nice to check if we have the MOOV before starting playing
- if (status) {
- this.setState({
- loadStatusMessage: status.message
- });
- }
- setTimeout(() => { this.updateLoadStatus() }, 250);
- } else {
- this.setState({
- readyToPlay: true,
- mimeType: status.mime_type,
- })
- const mediaFile = {
- createReadStream: function (opts) {
- // Return a readable stream that provides the bytes
- // between offsets "start" and "end" inclusive
- console.log('Stream between ' + opts.start + ' and ' + opts.end + '.');
- return fs.createReadStream(status.download_path, opts)
- }
- };
- var elem = this.refs.video;
- var videostream = VideoStream(mediaFile, elem);
- elem.play();
- }
- });
- },
- render: function() {
- return (
- !this.state.readyToPlay
- ?
- :
-
- {this.state.controlsShown
- ?