From d097a0b1eec0dd8943505553379ee6bee7561bf0 Mon Sep 17 00:00:00 2001
From: YULIUS KURNIAWAN KRISTIANTO
Date: Thu, 5 Mar 2020 03:57:47 +0700
Subject: [PATCH 1/6] Added Ukrainian to supported language
Based on Translators LBRY Discord channel and LBRY zone on Transifex
---
ui/constants/supported_languages.js | 1 +
1 file changed, 1 insertion(+)
diff --git a/ui/constants/supported_languages.js b/ui/constants/supported_languages.js
index 98937777e..61a4c1919 100644
--- a/ui/constants/supported_languages.js
+++ b/ui/constants/supported_languages.js
@@ -29,6 +29,7 @@ const SUPPORTED_LANGUAGES = {
tr: LANGUAGES.tr[1],
cs: LANGUAGES.cs[1],
kn: LANGUAGES.kn[1],
+ uk: LANGUAGES.uk[1],
};
export default SUPPORTED_LANGUAGES;
From 88908a9fce07ed8b45cc1e12a5cd85baadf39649 Mon Sep 17 00:00:00 2001
From: jessop
Date: Thu, 5 Mar 2020 14:56:56 -0500
Subject: [PATCH 2/6] update publishing messages: increase lbrytv limit until
tv transcoding warn about bitrate warn about strange types more reliably
convey size limit message
---
flow-typed/web-file.js | 3 +-
static/app-strings.json | 9 ++-
ui/component/publishFile/view.jsx | 118 +++++++++++++++++++++++++-----
ui/scss/init/_gui.scss | 5 ++
4 files changed, 115 insertions(+), 20 deletions(-)
diff --git a/flow-typed/web-file.js b/flow-typed/web-file.js
index 6bb0a4d10..afc6bf195 100644
--- a/flow-typed/web-file.js
+++ b/flow-typed/web-file.js
@@ -2,5 +2,6 @@ declare type WebFile = {
name: string,
title?: string,
path?: string,
- size?: string,
+ size: string,
+ type: string,
}
diff --git a/static/app-strings.json b/static/app-strings.json
index a1aed94e3..9024a68f9 100644
--- a/static/app-strings.json
+++ b/static/app-strings.json
@@ -1005,5 +1005,12 @@
"Model": "Model",
"Binary": "Binary",
"Other": "Other",
- "For video content, use MP4s in H264/AAC format and a friendly bitrate (720p) for more reliable streaming.": "For video content, use MP4s in H264/AAC format and a friendly bitrate (720p) for more reliable streaming."
+ "For video content, use MP4s in H264/AAC format and a friendly bitrate (720p) for more reliable streaming.": "For video content, use MP4s in H264/AAC format and a friendly bitrate (720p) for more reliable streaming.",
+ "Please check your deposit amount.": "Please check your deposit amount.",
+ "Your video has a bitrate over 5 mbps. We suggest transcoding to provide viewers the best experience.": "Your video has a bitrate over 5 mbps. We suggest transcoding to provide viewers the best experience.",
+ "For video content, use MP4s in H264/AAC format and a friendly bitrate (1080p) for more reliable streaming.": "For video content, use MP4s in H264/AAC format and a friendly bitrate (1080p) for more reliable streaming.",
+ "Unable to validate your video.": "Unable to validate your video.",
+ "Checking your video...": "Checking your video...",
+ "Your video has a bitrate over 8 mbps. We suggest transcoding to provide viewers the best experience.": "Your video has a bitrate over 8 mbps. We suggest transcoding to provide viewers the best experience.",
+ "Your video may not be the best format. Use MP4s in H264/AAC format and a friendly bitrate (1080p) for more reliable streaming.": "Your video may not be the best format. Use MP4s in H264/AAC format and a friendly bitrate (1080p) for more reliable streaming."
}
\ No newline at end of file
diff --git a/ui/component/publishFile/view.jsx b/ui/component/publishFile/view.jsx
index 43c83c382..ec2f0761f 100644
--- a/ui/component/publishFile/view.jsx
+++ b/ui/component/publishFile/view.jsx
@@ -1,6 +1,6 @@
// @flow
import * as ICONS from 'constants/icons';
-import React from 'react';
+import React, { useState, useEffect } from 'react';
import { regexInvalidURI } from 'lbry-redux';
import FileSelector from 'component/common/file-selector';
import Button from 'component/button';
@@ -33,6 +33,23 @@ function PublishFile(props: Props) {
clearPublish,
} = props;
+ const [duration, setDuration] = useState(0);
+ const [size, setSize] = useState(0);
+ const [oversized, setOversized] = useState(false);
+ const [isVid, setIsVid] = useState(false);
+ const RECOMMENDED_BITRATE = 8000000;
+ const TV_PUBLISH_SIZE_LIMIT: number = 100000000;
+ const UPLOAD_SIZE_MESSAGE = 'Lbrytv uploads are limited to 1 GB. Download the app for unrestricted publishing.';
+
+ // clear warnings
+ useEffect(() => {
+ if (!filePath || filePath === '' || filePath.name === '') {
+ setDuration(0);
+ setSize(0);
+ setIsVid(false);
+ }
+ }, [filePath]);
+
let currentFile = '';
if (filePath) {
if (typeof filePath === 'string') {
@@ -42,19 +59,96 @@ function PublishFile(props: Props) {
}
}
+ function getBitrate(size, duration) {
+ const s = Number(size);
+ const d = Number(duration);
+ if (s && d) {
+ return (s * 8) / d;
+ } else {
+ return 0;
+ }
+ }
+
+ function getMessage() {
+ // @if TARGET='web'
+ if (oversized || Number(size) > TV_PUBLISH_SIZE_LIMIT) {
+ return (
+
+ {__(
+ 'Your video may not be the best format. Use MP4s in H264/AAC format and a friendly bitrate (1080p) for more reliable streaming.'
+ )}{' '}
+
+
+ {__("If you don't choose a file, the file from your existing claim %name% will be used", { name: name })}
+
+ );
+ }
+
+ if (!isStillEditing) {
+ return (
+
+ {__(
+ 'For video content, use MP4s in H264/AAC format and a friendly bitrate (1080p) for more reliable streaming.'
+ )}{' '}
+
+
+ );
+ }
+ }
+
function handleFileChange(file: WebFile) {
const { showToast } = props;
-
+ window.URL = window.URL || window.webkitURL;
// if electron, we'll set filePath to the path string because SDK is handling publishing.
// if web, we set the filePath (dumb name) to the File() object
// File.path will be undefined from web due to browser security, so it will default to the File Object.
+ setSize(file ? file.size : 0);
+ setDuration(0);
+ setOversized(false);
+
+ // if video, extract duration so we can warn about bitrate
+ const isVideo = file.type.split('/')[0] === 'video';
+ setIsVid(isVideo);
+ if (isVideo) {
+ const video = document.createElement('video');
+ video.preload = 'metadata';
+ video.onloadedmetadata = function() {
+ setDuration(video.duration);
+ window.URL.revokeObjectURL(video.src);
+ };
+ video.src = window.URL.createObjectURL(file);
+ }
// @if TARGET='web'
// we only need to enforce file sizes on 'web'
- const PUBLISH_SIZE_LIMIT: number = 512000000;
if (typeof file !== 'string') {
- if (file && file.size && Number(file.size) > PUBLISH_SIZE_LIMIT) {
- showToast(__('File uploads currently limited to 500MB. Download the app for unlimited publishing.'));
+ if (file && file.size && Number(file.size) > TV_PUBLISH_SIZE_LIMIT) {
+ setOversized(true);
+ showToast(__(UPLOAD_SIZE_MESSAGE));
updatePublishForm({ filePath: '', name: '' });
return;
}
@@ -103,19 +197,7 @@ function PublishFile(props: Props) {
actions={
- {!isStillEditing && (
-
- {__(
- 'For video content, use MP4s in H264/AAC format and a friendly bitrate (720p) for more reliable streaming.'
- )}{' '}
- .
-
- )}
- {!!isStillEditing && name && (
-
- {__("If you don't choose a file, the file from your existing claim %name% will be used", { name: name })}
-
{__('Your video has a bitrate over 8 mbps. We suggest transcoding to provide viewers the best experience.')}{' '}
-
+
);
}
@@ -95,7 +95,7 @@ function PublishFile(props: Props) {
{__(
'Your video may not be the best format. Use MP4s in H264/AAC format and a friendly bitrate (1080p) for more reliable streaming.'
)}{' '}
-
+
);
}
@@ -114,7 +114,7 @@ function PublishFile(props: Props) {
{__(
'For video content, use MP4s in H264/AAC format and a friendly bitrate (1080p) for more reliable streaming.'
)}{' '}
-
+
);
}
From 79c1f60f43803637af5926e3b84950653d30f503 Mon Sep 17 00:00:00 2001
From: jessop
Date: Thu, 5 Mar 2020 15:03:36 -0500
Subject: [PATCH 4/6] tv publish limit
---
ui/component/publishFile/view.jsx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/ui/component/publishFile/view.jsx b/ui/component/publishFile/view.jsx
index 277375928..df8878cc3 100644
--- a/ui/component/publishFile/view.jsx
+++ b/ui/component/publishFile/view.jsx
@@ -38,7 +38,7 @@ function PublishFile(props: Props) {
const [oversized, setOversized] = useState(false);
const [isVid, setIsVid] = useState(false);
const RECOMMENDED_BITRATE = 8000000;
- const TV_PUBLISH_SIZE_LIMIT: number = 100000000;
+ const TV_PUBLISH_SIZE_LIMIT: number = 1073741824;
const UPLOAD_SIZE_MESSAGE = 'Lbrytv uploads are limited to 1 GB. Download the app for unrestricted publishing.';
// clear warnings
From 942b2ee64b208f0d3bcea3a6c52a1c740583bebc Mon Sep 17 00:00:00 2001
From: jessop
Date: Thu, 5 Mar 2020 15:15:47 -0500
Subject: [PATCH 5/6] mention tv upload limit upfront
---
static/app-strings.json | 3 ++-
ui/component/publishFile/view.jsx | 17 ++++++++++++++++-
2 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/static/app-strings.json b/static/app-strings.json
index 9024a68f9..ef663f169 100644
--- a/static/app-strings.json
+++ b/static/app-strings.json
@@ -1012,5 +1012,6 @@
"Unable to validate your video.": "Unable to validate your video.",
"Checking your video...": "Checking your video...",
"Your video has a bitrate over 8 mbps. We suggest transcoding to provide viewers the best experience.": "Your video has a bitrate over 8 mbps. We suggest transcoding to provide viewers the best experience.",
- "Your video may not be the best format. Use MP4s in H264/AAC format and a friendly bitrate (1080p) for more reliable streaming.": "Your video may not be the best format. Use MP4s in H264/AAC format and a friendly bitrate (1080p) for more reliable streaming."
+ "Your video may not be the best format. Use MP4s in H264/AAC format and a friendly bitrate (1080p) for more reliable streaming.": "Your video may not be the best format. Use MP4s in H264/AAC format and a friendly bitrate (1080p) for more reliable streaming.",
+ "Publishing Guide": "Publishing Guide"
}
\ No newline at end of file
diff --git a/ui/component/publishFile/view.jsx b/ui/component/publishFile/view.jsx
index df8878cc3..4f9bde212 100644
--- a/ui/component/publishFile/view.jsx
+++ b/ui/component/publishFile/view.jsx
@@ -47,6 +47,7 @@ function PublishFile(props: Props) {
setDuration(0);
setSize(0);
setIsVid(false);
+ setOversized(false);
}
}, [filePath]);
@@ -71,7 +72,7 @@ function PublishFile(props: Props) {
function getMessage() {
// @if TARGET='web'
- if (oversized || Number(size) > TV_PUBLISH_SIZE_LIMIT) {
+ if (oversized) {
return (
{__(UPLOAD_SIZE_MESSAGE)}{' '}
@@ -107,7 +108,20 @@ function PublishFile(props: Props) {
+ {__(
+ 'For video content, use MP4s in H264/AAC format and a friendly bitrate (1080p) for more reliable streaming. Lbrytv uploads are restricted to 1GB.'
+ )}{' '}
+
+
@@ -118,6 +132,7 @@ function PublishFile(props: Props) {
);
}
+ // @endif
}
function handleFileChange(file: WebFile) {
From b9a602acd9c25bff18667b4c072d4b6c2a5abd73 Mon Sep 17 00:00:00 2001
From: jessop
Date: Thu, 5 Mar 2020 19:17:59 -0500
Subject: [PATCH 6/6] warning text
---
static/app-strings.json | 8 +++-----
ui/component/publishFile/view.jsx | 4 ++--
ui/scss/init/_gui.scss | 4 ++--
ui/scss/themes/dark.scss | 1 +
ui/scss/themes/light.scss | 1 +
5 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/static/app-strings.json b/static/app-strings.json
index ef663f169..8555a55ac 100644
--- a/static/app-strings.json
+++ b/static/app-strings.json
@@ -1005,13 +1005,11 @@
"Model": "Model",
"Binary": "Binary",
"Other": "Other",
- "For video content, use MP4s in H264/AAC format and a friendly bitrate (720p) for more reliable streaming.": "For video content, use MP4s in H264/AAC format and a friendly bitrate (720p) for more reliable streaming.",
"Please check your deposit amount.": "Please check your deposit amount.",
- "Your video has a bitrate over 5 mbps. We suggest transcoding to provide viewers the best experience.": "Your video has a bitrate over 5 mbps. We suggest transcoding to provide viewers the best experience.",
"For video content, use MP4s in H264/AAC format and a friendly bitrate (1080p) for more reliable streaming.": "For video content, use MP4s in H264/AAC format and a friendly bitrate (1080p) for more reliable streaming.",
- "Unable to validate your video.": "Unable to validate your video.",
"Checking your video...": "Checking your video...",
"Your video has a bitrate over 8 mbps. We suggest transcoding to provide viewers the best experience.": "Your video has a bitrate over 8 mbps. We suggest transcoding to provide viewers the best experience.",
"Your video may not be the best format. Use MP4s in H264/AAC format and a friendly bitrate (1080p) for more reliable streaming.": "Your video may not be the best format. Use MP4s in H264/AAC format and a friendly bitrate (1080p) for more reliable streaming.",
- "Publishing Guide": "Publishing Guide"
-}
\ No newline at end of file
+ "Publishing Guide": "Publishing Guide",
+ "This is equivalent to a password. Do not post or share this.": "This is equivalent to a password. Do not post or share this."
+}
diff --git a/ui/component/publishFile/view.jsx b/ui/component/publishFile/view.jsx
index 4f9bde212..49452f950 100644
--- a/ui/component/publishFile/view.jsx
+++ b/ui/component/publishFile/view.jsx
@@ -83,7 +83,7 @@ function PublishFile(props: Props) {
// @endif
if (isVid && duration && getBitrate(size, duration) > RECOMMENDED_BITRATE) {
return (
-
+
{__('Your video has a bitrate over 8 mbps. We suggest transcoding to provide viewers the best experience.')}{' '}
@@ -92,7 +92,7 @@ function PublishFile(props: Props) {
if (isVid && !duration) {
return (
-
+
{__(
'Your video may not be the best format. Use MP4s in H264/AAC format and a friendly bitrate (1080p) for more reliable streaming.'
)}{' '}
diff --git a/ui/scss/init/_gui.scss b/ui/scss/init/_gui.scss
index a04c73eef..5ea73d2eb 100644
--- a/ui/scss/init/_gui.scss
+++ b/ui/scss/init/_gui.scss
@@ -208,8 +208,8 @@ a {
}
.help--warning {
- background-color: var(--color-warning);
- color: var(--color-black);
+ @extend .help;
+ color: var(--color-text-help-warning);
}
.help--inline {
diff --git a/ui/scss/themes/dark.scss b/ui/scss/themes/dark.scss
index 1bad47008..f42d4a831 100644
--- a/ui/scss/themes/dark.scss
+++ b/ui/scss/themes/dark.scss
@@ -44,6 +44,7 @@
// Text
--color-text: #eeeeee;
--color-text-error: #f5748c;
+ --color-text-help-warning: #f5ec74;
--color-text-empty: #bbbbbb;
--color-text-help: #bbbbbb;
--color-text-subtitle: #9fafc0;
diff --git a/ui/scss/themes/light.scss b/ui/scss/themes/light.scss
index fa070c0f3..ae0ecccb1 100644
--- a/ui/scss/themes/light.scss
+++ b/ui/scss/themes/light.scss
@@ -24,6 +24,7 @@
--color-text-help: #999999;
--color-text-subtitle: #767676;
--color-text-warning: #212529;
+ --color-text-help-warning: #989b20;
--color-text-warning--background: var(--lbry-yellow-1);
--color-blockquote: var(--color-gray-3);