From 0ecf492a20fdf6e74d524ed411e4c763c5347889 Mon Sep 17 00:00:00 2001 From: Job Evers-Meltzer Date: Mon, 16 Jan 2017 13:57:40 -0500 Subject: [PATCH 01/24] need absolute paths for electron --- js/component/drawer.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/js/component/drawer.js b/js/component/drawer.js index c43239345..7ced71391 100644 --- a/js/component/drawer.js +++ b/js/component/drawer.js @@ -40,13 +40,13 @@ var Drawer = React.createClass({ - - - - - - - {isLinux ? : null} + + + + + + + {isLinux ? : null} ); } From e95f1b8163d69632879fdff614bc460fed273b19 Mon Sep 17 00:00:00 2001 From: Job Evers-Meltzer Date: Thu, 19 Jan 2017 03:50:08 -0600 Subject: [PATCH 02/24] add html5 video playback --- js/page/watch.js | 24 +++++++++++++++++------- package.json | 6 ++++-- webpack.config.js | 3 ++- 3 files changed, 23 insertions(+), 10 deletions(-) diff --git a/js/page/watch.js b/js/page/watch.js index b145f1a65..642272023 100644 --- a/js/page/watch.js +++ b/js/page/watch.js @@ -2,6 +2,10 @@ import React from 'react'; import lbry from '../lbry.js'; import LoadScreen from '../component/load_screen.js' +const fs = require('fs'); +const VideoStream = require('videostream'); + + var WatchPage = React.createClass({ propTypes: { name: React.PropTypes.string, @@ -22,6 +26,7 @@ var WatchPage = React.createClass({ lbry.getFileStatus(this.props.name, (status) => { if (!status || status.code != 'running' || 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 @@ -33,11 +38,17 @@ var WatchPage = React.createClass({ readyToPlay: true, mimeType: status.mime_type, }) - var player = new MediaElementPlayer(this.refs.player, { - mode: 'shim', - plugins: ['flash'], - setDimensions: false, - }); + 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(); } }); }, @@ -46,8 +57,7 @@ var WatchPage = React.createClass({ !this.state.readyToPlay ? :
-