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

Fix babel support for legacy browsers #2131

Merged
merged 7 commits into from
Dec 5, 2020

Conversation

dmitrylyzo
Copy link
Contributor

Changes

  • Setup webpack to use browserslist.
  • Add polyfill for dynamic import of external module.
  • Re-add polyfills to fix slideshow and scrollManager.

Issues
Fixes #2046

@dmitrylyzo dmitrylyzo added p: tizen This PR or issue mainly concerns Tizen clients p: webos This PR or issue mainly concerns WebOS clients labels Nov 27, 2020
@dmitrylyzo
Copy link
Contributor Author

Need (?) to be transpiled (to remove const):

  • serviceworker.js
  • pdf.worker.js
  • worker-bundle.js

SubtitleOctopus doesn't seem to work because it's not being imported anywhere.

@dmitrylyzo dmitrylyzo marked this pull request as draft November 27, 2020 22:33
@dmitrylyzo
Copy link
Contributor Author

dmitrylyzo commented Nov 27, 2020

SubtitleOctopus doesn't seem to work because it's not being imported anywhere.

Babel breaks it and other 2 modules, so I added an extra babel-loader block.

pdfPlayer seems to work.
But not in webOS 1.2: pdf.worker.js contains const.

On webOS 1.2, SubtitlesOctopus cannot load .../web/libraries/subtitles-octopus-worker-legacy.js.mem (server returns 404), but file is there.

@github-actions github-actions bot added the merge conflict Conflicts prevent merging label Dec 1, 2020
@oddstr13
Copy link
Member

oddstr13 commented Dec 1, 2020

Tested using the webOS 3 emulator
Not everything works yet, but at least Jellyfin loads now.

Books

  • pdf: Uncaught SyntaxError: Unexpected token ( pdf.worker.js:2 (Same error that prevented Jellyfin completely from loading without this PR)
  • epub: Seem to just not load. White screen with loading circle for a little while, then all the controls disappear.
    I can resume browsing Jellyfin by using the back button.

Video

Looks like something's wrong with the playback profiles?
Audio only, white background behind the OSD.

media element error: 4  htmlVideoPlayer-plugin.bundle.js:1
playbackmanager playback error type: medianotsupported main.bundle.js:2
Unhandled promise rejection undefined main.bundle.js:2

Edit: I don't know what's going on any more. Sometimes it works, sometimes it doesn't…

@dmitrylyzo
Copy link
Contributor Author

Tested using the webOS 3 emulator

imo, webOS 3 emulator is buggiest one.

I don't know what's going on any more. Sometimes it works, sometimes it doesn't…

In webOS 1.2 and webOS 3 emulators, DirectPlay video works, Transcode - doesn't (black screen, no progress). I have this behavior since I started working with Jellyfin on webOS.

Current problems:

  1. ASS doesn't work because server doesn't return file libraries/subtitles-octopus-worker-legacy.js.mem (as I said above).
  2. I don't know how to transpile workers (using webpack config):
    worker-bundle.js (libarchive.js)
    pdf.worker.js (pdfjs-dist)
    serviceworker.js

@github-actions github-actions bot removed the merge conflict Conflicts prevent merging label Dec 3, 2020
@dmitrylyzo
Copy link
Contributor Author

I excluded SubtitlesOctopus from babel because lastRendered is global which cannot be set in strict mode.
https://github.com/jellyfin/JavascriptSubtitlesOctopus/blob/58e9a3f1a7f7883556ee002545f445a430120639/src/subtitles-octopus.js#L331

It seems that this const is guarded by try/catch, so babel is not needed 🤞
https://github.com/jellyfin/JavascriptSubtitlesOctopus/blob/58e9a3f1a7f7883556ee002545f445a430120639/src/subtitles-octopus.js#L6

The rest of issues are left for next time.

@dmitrylyzo dmitrylyzo marked this pull request as ready for review December 3, 2020 20:35
@dmitrylyzo dmitrylyzo force-pushed the es6-webos branch 2 times, most recently from 3565ff7 to 866c30f Compare December 3, 2020 21:55
@thornbill thornbill changed the title ES6 webOS 1.2 Fix babel support for legacy browsers Dec 4, 2020
@oddstr13
Copy link
Member

oddstr13 commented Dec 4, 2020

I'm testing with this PR rebased on top of master.

Testing is done on the following TV (ares-device-info):

modelName : 49UH603V-ZE
sdkVersion : 3.3.0
firmwareVersion : 05.30.65
boardType : K2L_DVB_EU

Video

Playback seems flawless, but I don't have a extensive codec test library set up.

Music

No OSD.

Attempting to play an unsupported track just stops playback.

Requesting url without automatic networking: http://10.79.1.0:8096/Sessions/Playing/Progress main.bundle.js:2
media element error: 4  htmlAudioPlayer-plugin.bundle.js:1
playbackmanager playback error type: medianotsupported main.bundle.js:2
Requesting url without automatic networking: http://10.79.1.0:8096/Sessions/Playing/Stopped main.bundle.js:2

PDF

Forever loading on a white background;

Warning: Setting up fake worker. 2986.bundle.js:2
Uncaught SyntaxError: Unexpected token ( pdf.worker.js:2
Unhandled promise rejection Error: Setting up fake worker failed: "Cannot read property 'WorkerMessageHandler' of undefined". {stack: (...), message: "Setting up fake worker failed: "Cannot read property 'WorkerMessageHandler' of undefined"."} main.bundle.js:2

epub

Loading for a while, then just a white screen. Looks like it's supposed to be displaying the cover image – I had the same issue in the browser, but that was fixed a while back. No javascript errors;
image

CBZ

Infinite loading on dark background. The file does get fetched (if it can fit in cache, otherwise the app is forcefully restarted)

Uncaught SyntaxError: Use of const in strict mode. worker-bundle.js:1
This error is observed with the CBZ player in Firefox
20:45:39.522 Uncaught (in promise) TypeError: URL.createObjectURL: Argument 1 is not valid for any of the 1-argument overloads.
    e http://1070l:8096/web/comicsPlayer-plugin.bundle.js:1
    d http://1070l:8096/web/main.bundle.js:2
    _invoke http://1070l:8096/web/main.bundle.js:2
    k http://1070l:8096/web/main.bundle.js:2
    E http://1070l:8096/web/comicsPlayer-plugin.bundle.js:1
    a http://1070l:8096/web/comicsPlayer-plugin.bundle.js:1
    promise callback*E http://1070l:8096/web/comicsPlayer-plugin.bundle.js:1
    a http://1070l:8096/web/comicsPlayer-plugin.bundle.js:1
    promise callback*E http://1070l:8096/web/comicsPlayer-plugin.bundle.js:1
    a http://1070l:8096/web/comicsPlayer-plugin.bundle.js:1
    promise callback*E http://1070l:8096/web/comicsPlayer-plugin.bundle.js:1
    a http://1070l:8096/web/comicsPlayer-plugin.bundle.js:1
    promise callback*E http://1070l:8096/web/comicsPlayer-plugin.bundle.js:1
    a http://1070l:8096/web/comicsPlayer-plugin.bundle.js:1
    promise callback*E http://1070l:8096/web/comicsPlayer-plugin.bundle.js:1
    a http://1070l:8096/web/comicsPlayer-plugin.bundle.js:1
    promise callback*E http://1070l:8096/web/comicsPlayer-plugin.bundle.js:1
    a http://1070l:8096/web/comicsPlayer-plugin.bundle.js:1
    P http://1070l:8096/web/comicsPlayer-plugin.bundle.js:1
    P http://1070l:8096/web/comicsPlayer-plugin.bundle.js:1
    value http://1070l:8096/web/comicsPlayer-plugin.bundle.js:1
    value http://1070l:8096/web/comicsPlayer-plugin.bundle.js:1
    promise callback*value/< http://1070l:8096/web/comicsPlayer-plugin.bundle.js:1
    value http://1070l:8096/web/comicsPlayer-plugin.bundle.js:1
    value http://1070l:8096/web/comicsPlayer-plugin.bundle.js:1
    J http://1070l:8096/web/main.bundle.js:2
    J http://1070l:8096/web/main.bundle.js:2
    play http://1070l:8096/web/main.bundle.js:2
    promise callback*e/f.play/< http://1070l:8096/web/main.bundle.js:2
    promise callback*e/f.play http://1070l:8096/web/main.bundle.js:2
    u http://1070l:8096/web/main.bundle.js:2
    p http://1070l:8096/web/main.bundle.js:2
    TU http://1070l:8096/web/main.bundle.js:2
    attachedCallback http://1070l:8096/web/main.bundle.js:2
    l http://1070l:8096/web/main.bundle.js:2
    b http://1070l:8096/web/main.bundle.js:2
    t http://1070l:8096/web/main.bundle.js:2
    upgrade http://1070l:8096/web/main.bundle.js:2
    o http://1070l:8096/web/main.bundle.js:2
    c http://1070l:8096/web/main.bundle.js:2
    t http://1070l:8096/web/main.bundle.js:2
    n http://1070l:8096/web/main.bundle.js:2
    n http://1070l:8096/web/main.bundle.js:2
    t http://1070l:8096/web/main.bundle.js:2
    c http://1070l:8096/web/main.bundle.js:2
    a http://1070l:8096/web/main.bundle.js:2
    h http://1070l:8096/web/main.bundle.js:2
    h http://1070l:8096/web/main.bundle.js:2
    h http://1070l:8096/web/main.bundle.js:2
    g http://1070l:8096/web/main.bundle.js:2
    y http://1070l:8096/web/main.bundle.js:2
    o http://1070l:8096/web/main.bundle.js:2
    forDocumentTree http://1070l:8096/web/main.bundle.js:2
    upgradeDocumentTree http://1070l:8096/web/main.bundle.js:2

@dmitrylyzo
Copy link
Contributor Author

No OSD.

On TV, music is controlled by remote page - note sign at the top menu.

@oddstr13
Copy link
Member

oddstr13 commented Dec 4, 2020

No OSD.

On TV, music is controlled by remote page - note sign at the top menu.

Yes, I did find that. Kinda expected some sort of HUD still however – but that's irrelevant to this PR then.

@sonarcloud
Copy link

sonarcloud bot commented Dec 5, 2020

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
2.2% 2.2% Duplication

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p: tizen This PR or issue mainly concerns Tizen clients p: webos This PR or issue mainly concerns WebOS clients
Projects
None yet
Development

Successfully merging this pull request may close these issues.

webOS: Use of const in strict mode (webcomponents?)
4 participants