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

vjs: hide errors when updating i18n #7004

Merged
merged 1 commit into from Sep 2, 2021
Merged

vjs: hide errors when updating i18n #7004

merged 1 commit into from Sep 2, 2021

Conversation

infinite-persistence
Copy link
Contributor

Issue

#6989 console errors and warnings are getting out of hand!

16:07:53.259 react_devtools_backend.js:2850 VIDEOJS: ERROR: TypeError: Cannot read properties of undefined (reading 'controlText')
    at Player.resolveCtrlText (videojs.jsx?8d8d:319)
    at HTMLDivElement.data.dispatcher (video.es.js?6651:2207)
    at trigger (video.es.js?6651:2349)
    at Player.trigger$1 [as trigger] (video.es.js?6651:3277)
    at Player.handleTechLoadStart_ (video.es.js?6651:23074)
    at Player.eval (video.es.js?6651:22824)
    at HTMLVideoElement.data.dispatcher (video.es.js?6651:2207)

Notes

This method was previously criticized in 5643. But given that no better solution was submitted after a long while, nor was there a new solution for doing i18n, I'm reviving it again. It'll be no worse from the status quo.

Despite try-catch being overkill, I think the code-clarity outweighs the performance issues (if any, in the first place). Also, we are only suppressing the error in a very specialized function which even if it fails, will simply be a no-op and the GUI falling back to English.

But still open to better solutions.

## Issue
6989 console errors and warnings are getting out of hand!

## Notes
This method was previously criticized in 5643. But given that no better solution has been submitted after a long while, nor is there a new solution for doing i18n, I'm reviving it again. It'll be no worse from the status quo.

Despite try-catch being overkill, I think the code-clarity outweighs the performance issues (if any, in the first place). Also, we are only suppressing the error in a very specialized function which even if it fails, will simply be a no-op and the GUI falling back to English.
@tzarebczan tzarebczan merged commit 061e4dd into master Sep 2, 2021
@tzarebczan tzarebczan deleted the ip/vjs.i18n branch September 2, 2021 16:38
rafael-xmr pushed a commit that referenced this pull request Sep 2, 2021
commit 1eb6525
Author: saltrafael <76502841+saltrafael@users.noreply.github.com>
Date:   Wed Sep 1 10:37:49 2021 -0300

    Update CHANGELOG.md

commit d2b8db3
Author: saltrafael <a657ee92-7eb9-46eb-97d2-6735799df838@aleeas.com>
Date:   Wed Sep 1 15:16:12 2021 -0300

    Bump redux

commit 8637df1
Author: saltrafael <a657ee92-7eb9-46eb-97d2-6735799df838@aleeas.com>
Date:   Thu Sep 2 14:32:38 2021 -0300

    Add separate control for autoplay next in list

commit d79e236
Author: saltrafael <a657ee92-7eb9-46eb-97d2-6735799df838@aleeas.com>
Date:   Thu Sep 2 08:21:36 2021 -0300

    Add Autoplay Next Button

commit c90b7e3
Author: saltrafael <a657ee92-7eb9-46eb-97d2-6735799df838@aleeas.com>
Date:   Thu Sep 2 14:10:38 2021 -0300

    Add Play Previous Button

commit f6a1278
Author: saltrafael <a657ee92-7eb9-46eb-97d2-6735799df838@aleeas.com>
Date:   Tue Aug 31 08:00:49 2021 -0300

    Add Play Previous VJS Component

commit e3f1964
Author: saltrafael <a657ee92-7eb9-46eb-97d2-6735799df838@aleeas.com>
Date:   Tue Aug 31 07:57:20 2021 -0300

    Add Play Next Button

commit a7af0c4
Author: saltrafael <a657ee92-7eb9-46eb-97d2-6735799df838@aleeas.com>
Date:   Tue Aug 31 07:45:31 2021 -0300

    Add Play Next VJS component

commit a414fcd
Author: saltrafael <a657ee92-7eb9-46eb-97d2-6735799df838@aleeas.com>
Date:   Mon Aug 30 14:22:29 2021 -0300

    Add Theater Mode to its own class and fix bar text display

commit fbbbce1
Author: saltrafael <a657ee92-7eb9-46eb-97d2-6735799df838@aleeas.com>
Date:   Mon Aug 30 14:11:56 2021 -0300

    Fix List playback on Floating Player

commit 23e2229
Author: saltrafael <a657ee92-7eb9-46eb-97d2-6735799df838@aleeas.com>
Date:   Tue Aug 31 09:35:15 2021 -0300

    CSS: Fix Large list titles

commit 3284cbc
Author: saltrafael <a657ee92-7eb9-46eb-97d2-6735799df838@aleeas.com>
Date:   Sun Aug 15 11:31:51 2021 -0300

    Fix Modal Remove Collection I18n

commit c2336d3
Author: saltrafael <a657ee92-7eb9-46eb-97d2-6735799df838@aleeas.com>
Date:   Wed Sep 1 07:27:05 2021 -0300

    Add Shuffle Play Option on List Page and Menus

commit 887ca7d
Author: saltrafael <a657ee92-7eb9-46eb-97d2-6735799df838@aleeas.com>
Date:   Tue Aug 31 07:27:36 2021 -0300

    Add Play Button to List page

commit b3860bc
Author: saltrafael <a657ee92-7eb9-46eb-97d2-6735799df838@aleeas.com>
Date:   Mon Aug 30 12:56:50 2021 -0300

    Improve View List Link and Fetch action

commit c90697b
Author: saltrafael <a657ee92-7eb9-46eb-97d2-6735799df838@aleeas.com>
Date:   Mon Aug 30 12:45:21 2021 -0300

    Add Shuffle control for Lists

commit 53a4ecf
Author: saltrafael <a657ee92-7eb9-46eb-97d2-6735799df838@aleeas.com>
Date:   Wed Sep 1 08:07:33 2021 -0300

    Add Loop Control for Lists

commit 3e02fcb
Author: saltrafael <a657ee92-7eb9-46eb-97d2-6735799df838@aleeas.com>
Date:   Wed Sep 1 08:06:55 2021 -0300

    Add Replay Option to autoplayCountdown

commit 02ad9a6
Author: saltrafael <a657ee92-7eb9-46eb-97d2-6735799df838@aleeas.com>
Date:   Wed Aug 11 17:20:04 2021 -0300

    Add Replay Icon

commit 9e34247
Author: saltrafael <a657ee92-7eb9-46eb-97d2-6735799df838@aleeas.com>
Date:   Wed Aug 11 13:56:06 2021 -0300

    Add Shuffle icon

commit 37fde66
Author: saltrafael <a657ee92-7eb9-46eb-97d2-6735799df838@aleeas.com>
Date:   Wed Aug 11 13:52:23 2021 -0300

    Add Repeat icon

commit a872fa6
Author: saltrafael <a657ee92-7eb9-46eb-97d2-6735799df838@aleeas.com>
Date:   Wed Sep 1 08:10:25 2021 -0300

    Dont show countdown on Lists

commit 061e4dd
Author: infinite-persistence <64950861+infinite-persistence@users.noreply.github.com>
Date:   Thu Sep 2 09:38:58 2021 -0700

    vjs: hide errors when updating i18n (#7004)

    ## Issue
    6989 console errors and warnings are getting out of hand!

    ## Notes
    This method was previously criticized in 5643. But given that no better solution has been submitted after a long while, nor is there a new solution for doing i18n, I'm reviving it again. It'll be no worse from the status quo.

    Despite try-catch being overkill, I think the code-clarity outweighs the performance issues (if any, in the first place). Also, we are only suppressing the error in a very specialized function which even if it fails, will simply be a no-op and the GUI falling back to English.

commit a0f164c
Author: infinite-persistence <inf.persistence@gmail.com>
Date:   Thu Sep 2 20:50:03 2021 +0800

    Add streamer badge

    https://lbryians.slack.com/archives/C01LTTCEURW/p1629489255028900
infinite-persistence added a commit that referenced this pull request Sep 7, 2021
- Reverted #7004 as it ended up preventing the rest of the components from being localized when there is an error. Replaced that with an `setLabel` that simply checks if the component exists before setting the label.

- Fix "Autoplay Next On" not localized on initial load -- it was only localized when the setting changes. It is unfortunate that we need to set the label in an additional `useEffect`, but so be it.
infinite-persistence added a commit that referenced this pull request Sep 7, 2021
- Reverted #7004 as it ended up preventing the rest of the components from being localized when there is an error. Replaced that with a `setLabel` that simply checks if the component exists before setting the label.

- Fix "Autoplay Next On" not localized on initial load -- it was only localized when the setting changes. It is unfortunate that we need to also set the label in an additional `useEffect` instead of just using vjs events, but so be it.
rafael-xmr pushed a commit that referenced this pull request Sep 7, 2021
commit b2ec92e
Author: saltrafael <a657ee92-7eb9-46eb-97d2-6735799df838@aleeas.com>
Date:   Tue Sep 7 07:19:54 2021 -0300

    Better handle paid content on playlists

commit 7291a2f
Author: saltrafael <a657ee92-7eb9-46eb-97d2-6735799df838@aleeas.com>
Date:   Mon Sep 6 09:21:21 2021 -0300

    Fix and improve code

commit 802b473
Author: saltrafael <a657ee92-7eb9-46eb-97d2-6735799df838@aleeas.com>
Date:   Tue Sep 7 07:31:31 2021 -0300

    Add snack bar notification

commit 124aa90
Author: infinite-persistence <inf.persistence@gmail.com>
Date:   Tue Sep 7 16:03:05 2021 +0800

    Fix Duration widget error-message logic

    - It didn't remove the error msg when the input is cleared.
    - It didn't update to the latest error msg if one already existed.

commit 6a5ea5d
Author: infinite-persistence <inf.persistence@gmail.com>
Date:   Tue Sep 7 16:10:40 2021 +0800

    Vertically center 'icon--help' (redo)

    A better fix with extra specificity, since the main issue was with form-fields only. The previous fix was too wide and broke other areas with column flex.

commit a6ece46
Author: infinite-persistence <inf.persistence@gmail.com>
Date:   Tue Sep 7 14:40:59 2021 +0800

    Vertically center 'icon--help'

    Reasons:
    - Better symmetry.
    - When used on a form-field label, the off-centeredness causes an extra offset at the top. Since the icon goes away when there is an input error, the form-field shifts a bit. (An alternative is to use a smaller icon, but I think size 16 is the best for legibility).

commit a227e6a
Author: infinite-persistence <inf.persistence@gmail.com>
Date:   Tue Sep 7 10:25:38 2021 +0800

    i18n + vjs i18n fixes

    - Reverted #7004 as it ended up preventing the rest of the components from being localized when there is an error. Replaced that with a `setLabel` that simply checks if the component exists before setting the label.

    - Fix "Autoplay Next On" not localized on initial load -- it was only localized when the setting changes. It is unfortunate that we need to also set the label in an additional `useEffect` instead of just using vjs events, but so be it.

commit aceb8b8
Author: saltrafael <76502841+saltrafael@users.noreply.github.com>
Date:   Mon Sep 6 14:33:53 2021 -0300

    Fix autoplay not saving (#7028)

    * Fix autoplay not saving

    * Bump redux

commit f246992
Author: saltrafael <76502841+saltrafael@users.noreply.github.com>
Date:   Mon Sep 6 11:06:07 2021 -0300

    Fix auto downloads (#7021)

commit 95278f1
Merge: 91ef545 f8e9047
Author: infinite-persistence <inf.persistence@gmail.com>
Date:   Fri Sep 3 23:53:49 2021 +0800

    #7015 Allow moderators to perform Timeout as well.

commit f8e9047
Author: infinite-persistence <inf.persistence@gmail.com>
Date:   Fri Sep 3 23:33:04 2021 +0800

    Allow moderators to perform Timeout as well.

commit 04f3dfb
Author: infinite-persistence <inf.persistence@gmail.com>
Date:   Fri Sep 3 23:28:09 2021 +0800

    Corrected logic that was bypassing the muted list.

commit 91ef545
Author: jessopb <36554050+jessopb@users.noreply.github.com>
Date:   Fri Sep 3 11:29:23 2021 -0400

    Fix stale recsys and fix watchman uncaught promise when videoPlayer is not initialized (#7014)

    * do not set stale recsys id

    * no watchman send if videoplay not initialized

commit 03d56d1
Merge: 049fb28 bf8ab2e
Author: infinite-persistence <inf.persistence@gmail.com>
Date:   Fri Sep 3 22:42:26 2021 +0800

    #6872 Comment Moderation - time based bans

commit bf8ab2e
Author: infinite-persistence <inf.persistence@gmail.com>
Date:   Fri Sep 3 15:43:01 2021 +0800

    Run the extra app-side comment filter only if the claim is not ours.

    ## Preamble
    - The app-side uses a cached blocklist, so when a Timeout expires, it doesn't know that the ban has been lifted.
    - Meanwhile, we are doing extra comment filtering using this blocklist (so that we don't see comments that we have blocked, regardless of whose claim we are viewing).

    ## Issue
    In a livestream, if a new message from an ex-offender comes in after their ban has been lifted, we do get the websocket message but it's being filtered out locally as mentioned above. So, the msg ended up being visible for everyone except the owner.

    ## Fix (band aid)
    - Don't run the extra filter if the claim we are viewing is ours -- commentron would have filtered it for us anyways, and is the right logic to use even before this Timeout feature is introduced.
        - For the case of Timeout, this only serves as a band-aid until Commentron Issue 80 is available for us to detect the ban has been lifted. This is because it doesn't handle the case where I am a viewer and I decided to timeout someone for a few minutes. Because I am not the owner of the claim, the offender will continue to be blocked due to the same issue mentioned above.

commit 804edd3
Author: infinite-persistence <inf.persistence@gmail.com>
Date:   Fri Sep 3 16:47:06 2021 +0800

    Restrict "Timeout" feature to content owners

    The main reason to do this is because we are doing extra comment filtering using our blocklist (so that we don't see people we blocked regardless on who's content we are at), but we are also using a cached blocklist so we don't know when a Timeout will be lifted to allow new livestream messages. We will need Commentron Issue-80 to truly fix this.

    For the case of when we are the owner of the content, we don't run the extra filtering (since it is equivalent to Commentron's filtering), hence the issue doesn't exist. Any new livestream messages received through websocket won't be locally filtered.

commit 0c1554e
Author: infinite-persistence <inf.persistence@gmail.com>
Date:   Fri Aug 20 15:18:54 2021 +0800

    Blocklist Page: show the timeout ban duration

    - 'humanize-duration' is used because 'moment''s humanizer sucks.

commit 663376e
Author: infinite-persistence <inf.persistence@gmail.com>
Date:   Fri Aug 20 09:04:48 2021 +0800

    Block timeout was changed from "hours" to "seconds" in Commentron

commit a05ccdd
Author: infinite-persistence <inf.persistence@gmail.com>
Date:   Thu Aug 12 15:10:44 2021 +0800

    Comment Moderation - time based bans

    ## Issue
    6712 Comment Moderation - time based bans

    ## Approach
    - Consolidated the 3 types of blocking buttons in the comment content menu (i.e. Block, Moderator Block, Admin Block) into 1 regular Block button.
    - Show a modal when Block is clicked.
        - Let user choose the blocklist.
        - Let user choose the timeout duration (this PR's impetus).

commit 049fb28
Author: jessopb <36554050+jessopb@users.noreply.github.com>
Date:   Thu Sep 2 18:39:40 2021 -0400

    recsys v0.2 (#6977)

    * recsys wip

    better logging

    fix floating player popout playing uri bug with recsys

    lint

    add empty entries to create

    use beacon; fire on visibilitychange

    cleanup, not record recs if not seen

    ifweb recsys beacon

    recsys handle embeds, cleanup

    use history.listen to trigger events

    fix recsys embed bug

    bugfix

    more default data

    cleaner

    cleaner

    * remove tentative

    * disable recsys debug logging

commit 64cbd4a
Author: saltrafael <76502841+saltrafael@users.noreply.github.com>
Date:   Thu Sep 2 17:05:32 2021 -0300

    Expanded Playback and List controls (#6921)

    * Dont show countdown on Lists

    * Add Repeat icon

    * Add Shuffle icon

    * Add Replay Icon

    * Add Replay Option to autoplayCountdown

    * Add Loop Control for Lists

    * Add Shuffle control for Lists

    * Improve View List Link and Fetch action

    * Add Play Button to List page

    * Add Shuffle Play Option on List Page and Menus

    * Fix Modal Remove Collection I18n

    * CSS: Fix Large list titles

    * Fix List playback on Floating Player

    * Add Theater Mode to its own class and fix bar text display

    * Add Play Next VJS component

    * Add Play Next Button

    * Add Play Previous VJS Component

    * Add Play Previous Button

    * Add Autoplay Next Button

    * Add separate control for autoplay next in list

    * Bump redux

    * Update CHANGELOG.md

commit 061e4dd
Author: infinite-persistence <64950861+infinite-persistence@users.noreply.github.com>
Date:   Thu Sep 2 09:38:58 2021 -0700

    vjs: hide errors when updating i18n (#7004)

    ## Issue
    6989 console errors and warnings are getting out of hand!

    ## Notes
    This method was previously criticized in 5643. But given that no better solution has been submitted after a long while, nor is there a new solution for doing i18n, I'm reviving it again. It'll be no worse from the status quo.

    Despite try-catch being overkill, I think the code-clarity outweighs the performance issues (if any, in the first place). Also, we are only suppressing the error in a very specialized function which even if it fails, will simply be a no-op and the GUI falling back to English.

commit a0f164c
Author: infinite-persistence <inf.persistence@gmail.com>
Date:   Thu Sep 2 20:50:03 2021 +0800

    Add streamer badge

    https://lbryians.slack.com/archives/C01LTTCEURW/p1629489255028900
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.

None yet

2 participants