Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add FileRender component #1576

Merged
merged 16 commits into from
Jul 10, 2018
Merged

Add FileRender component #1576

merged 16 commits into from
Jul 10, 2018

Conversation

btzr-io
Copy link
Collaborator

@btzr-io btzr-io commented Jun 11, 2018

Changes

Todo

Copy link

@neb-b neb-b left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small changes

const icon = doesPlayback ? 'Play' : 'Folder';
const label = doesPlayback ? 'Play' : 'View';
const icon = doesPlayback ? 'Play' : 'Eye';
const label = doesPlayback ? 'Play' : 'Preview';
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you change these to use the icon constants?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done 👍

@btzr-io btzr-io requested a review from neb-b June 22, 2018 00:30
@lbry-bot lbry-bot assigned neb-b and unassigned kauffj Jun 22, 2018
@@ -26,3 +26,5 @@ export const HEART = 'Heart';
export const UNLOCK = 'Unlock';
export const CHECK_SIMPLE = 'Check';
export const GLOBE = 'Globe';
export const EYE = 'Eye';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This prompted: #1683

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(not necessary to resolve before merging this)

@btzr-io
Copy link
Collaborator Author

btzr-io commented Jun 27, 2018

Initial step for #620


class VideoPlayer extends React.PureComponent {
static MP3_CONTENT_TYPES = ['audio/mpeg3', 'audio/mpeg'];
static FILE_MEDIA_TYPES = ['3D-file', 'e-book', 'comic-book'];
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is comic-book an actual media type?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh I'm guessing this is just for future file types.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See #1377

@lbry-bot lbry-bot assigned neb-b and unassigned neb-b Jun 28, 2018
Copy link

@neb-b neb-b left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left a few more comments, not sure if all of them warrant changes.

Tom and I will be doing more testing on this tomorrow, with a lot of file types. Should be able to get it merged in the next day or two. Great work!

const noMetadataMessage = 'Waiting for metadata.';
const unplayableMessage = "Sorry, looks like we can't play this file.";
const hideMedia = this.playableType() && !hasMetadata && !unplayable;
const unsupportedMessage = "Sorry, looks like we can't preview this file.";
const isLoadingFile = !fileSource && this.fileType();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we are calling this.fileType() 3 times in 5 lines, lets just set it to a variable and use that for these checks below.

{isLoadingMetadata && <LoadingScreen status={noMetadataMessage} />}
{isUnplayable && <LoadingScreen status={unplayableMessage} spinner={false} />}
{unsupported ||
(isUnsupported && <LoadingScreen status={unsupportedMessage} spinner={false} />)}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this would be easier to follow if we had a shouldDisplayLoadingScreen() function or something.

const [isLoading, loadingStatus] = this.shouldDisplayLoadingScreen()

Then we would just need one LoadingScreen component


class VideoPlayer extends React.PureComponent {
static MP3_CONTENT_TYPES = ['audio/mpeg3', 'audio/mpeg'];
static FILE_MEDIA_TYPES = ['3D-file', 'e-book', 'comic-book'];
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh I'm guessing this is just for future file types.

// Render custom viewer: FileRender
if (this.fileType()) this.renderFile();
// Render default viewer: render-media (video, audio, img, iframe)
else if (this.supportedType()) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be an if, else if, else statement instead?

It looks like it could call renderAudio and the default viewer both.

@btzr-io btzr-io added the on hold Temporarily paused label Jul 5, 2018
@btzr-io btzr-io requested a review from neb-b July 10, 2018 03:01
@lbry-bot lbry-bot assigned neb-b and unassigned neb-b Jul 10, 2018
@btzr-io btzr-io removed the on hold Temporarily paused label Jul 10, 2018
@lbry-bot lbry-bot assigned neb-b and unassigned neb-b Jul 10, 2018
@neb-b neb-b merged commit e317f57 into master Jul 10, 2018
@btzr-io btzr-io deleted the file-preview branch July 26, 2018 03:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants