[go: up one dir, main page]

Page MenuHomePhabricator

Consolidate code for MediaViewer across desktop and mobile
Open, MediumPublic

Description

Background

Desktop and mobile use different implementations for displaying a lightbox when images are clicked. There is lots of user value e.g. performance/functionality to consolidating these two experiences. The main reason we have separate experiences is that the desktop version is considerably bloated (see T77349 for more context). If we can reduce the size of this feature and simplify the code we can make use of the desktop across platforms.

The benefits of consolidating the two experience would be:

  • One less unmaintained extension in our deployed servers
  • More functionality to mobile users
  • better frontend performance for desktop users
  • The ability to use multimedia viewer across platforms for new media experiences.

Side by side comparison

Features

Additional desktop features: Has support for 3d images; has sharing functionality; additional information in summary; full screen behaviour; keyboard support

Performance

Last checked: October 15th 2024.

Bootstrap modules:

  • Desktop: (mmv.bootstrap): 4.8 kB
  • Mobile: loaded as part of mobile.startup (0.3kb)

Asynchronously loaded code:

  • Desktop: 25.2 kB (CSS = 6.4kb, messages = 1.8kb, mmv/ui/ = 8.7kb, models = 1.9kb, providers = 1.8kb)
  • Mobile: mobile.mediaViewer is 3.2KB (the majority of the code is generalized in mobile.startup or Codex)

Technology

  • Desktop built using Codex CSS-only components
  • Mobile uses non-standard MobileFrontend library that makes use of Codex CSS-only components. Benefits from generalized components such as an overlayManager and a templating engine.

Plan

  • 1) Simplify existing entry points:
  • Merge MultimediaViewer bootstrap modules. There is no need for them to live in separate modules and they bloat the size of our ResourceLoader startup module unnecessarily
  • 2) Reduce reliance on UI code and CSS:
  • Consolidate the behaviours for the caption - remove features from desktop - this appears to be the main contributor to the large code size.
  • Simplify error handling in mmv.ui.canvas.js to match less detailed solution in mobile.

Screenshot 2024-10-15 at 8.35.16 PM.png (988×3 px, 153 KB)

Screenshot 2024-10-15 at 8.36.12 PM.png (434×1 px, 28 KB)

  • Replace mw-mmv-dialog with cdx-dialog
  • Explore whether using Mustache for remaining HTML construction. would reduce code footprint.

Related Objects

StatusSubtypeAssignedTask
OpenNone
OpenNone
OpenNone
OpenNone
DuplicateNone
OpenNone
DeclinedNone
OpenJdlrobson
DuplicateNone
OpenNone
DeclinedNone
ResolvedTheDJ
DeclinedNone
ResolvedJdlrobson
Resolved bmansurov
DeclinedNone
ResolvedJdlrobson
InvalidNone
Duplicate Nirzar
OpenNone
ResolvedJdlrobson
DeclinedNone
ResolvedEsanders
ResolvedEsanders
Resolvedmatmarex
Resolvedmatmarex
Resolvedovasileva
ResolvedABorbaWMF
ResolvedNone
DuplicateNone
DuplicateNone
ResolvedJdlrobson
ResolvedTheDJ
ResolvedTheDJ
DeclinedNone
OpenNone
OpenNone
ResolvedBUG REPORTTheDJ
OpenNone
ResolvedJdlrobson
OpenBUG REPORTNone

Event Timeline

There are a very large number of changes, so older changes are hidden. Show Older Changes
Jdlrobson renamed this task from Consolidate code for MediaViewer across desktop and mobile (tracking) to Consolidate code for MediaViewer across desktop and mobile.Mar 22 2023, 11:50 PM
Jdlrobson updated the task description. (Show Details)
Jdlrobson updated the task description. (Show Details)

Change #1032011 had a related patch set uploaded (by TheDJ; author: TheDJ):

[mediawiki/extensions/MultimediaViewer@master] Remove the thumbnail blurring

https://gerrit.wikimedia.org/r/1032011

Change #1032011 merged by jenkins-bot:

[mediawiki/extensions/MultimediaViewer@master] Remove the thumbnail blurring

https://gerrit.wikimedia.org/r/1032011

Jdlrobson updated the task description. (Show Details)

Change #1080832 had a related patch set uploaded (by Jdlrobson; author: Jdlrobson):

[mediawiki/extensions/SearchVue@master] mmv.bootstrap.autostart module was deprecated

https://gerrit.wikimedia.org/r/1080832

Change #1080834 had a related patch set uploaded (by Jdlrobson; author: Jdlrobson):

[mediawiki/skins/MinervaNeue@master] Mobile site should use the desktop media viewer

https://gerrit.wikimedia.org/r/1080834

Change #1080422 had a related patch set uploaded (by Jdlrobson; author: Jdlrobson):

[mediawiki/extensions/MobileFrontend@master] POC: Drop the mobile media viewer

https://gerrit.wikimedia.org/r/1080422

Change #1080428 had a related patch set uploaded (by Jdlrobson; author: Simon04):

[mediawiki/extensions/MultimediaViewer@master] Move HtmlUtils from mmv.bootstrap to mmv module

https://gerrit.wikimedia.org/r/1080428

Change #1080428 merged by jenkins-bot:

[mediawiki/extensions/MultimediaViewer@master] Move HtmlUtils from mmv.bootstrap to mmv module

https://gerrit.wikimedia.org/r/1080428

Change #1085682 had a related patch set uploaded (by Jdlrobson; author: Jdlrobson):

[mediawiki/extensions/MultimediaViewer@master] POC: Showcase a simplistic version of MMV

https://gerrit.wikimedia.org/r/1085682

Just an update here that I've been talking to a few people about what to do here. The sense I'm getting is that we likely want to keep the mobile media viewer as is as it presents a better experience for readers - most of the desktop features do not work nicely on mobile and are likely not as important to readers (who will click through to the file page if they want that information).

What I haven't worked out is how to get that state. A few options I am considering are:

  1. ) Adding a bunch of styling rules to the desktop version in a skinStyle to make it look more mobile like.
  2. Refactoring the existing desktop code so that we can have two versions of the media viewer in MultimediaViewer that share UI code - a simple version for mobile and a more complex for desktop. This would entail refactoring our classes and two modules - an advanced and simple media viewer making use of the refactored files.
  3. Complete rewrite of the desktop version in Vue
  4. Replacing the mobile version with the desktop version
  5. Keeping the status quo of two separate experiences.

Today I explored 2 and I spent some time building a proof of concept to see how much multimedia viewer could be simplified to render the existing mobile experience. The existing mobile experience could be achieved with 12.3 kB of code (compared with 25.3kb for desktop). I'm pretty sure that can be cut down further by refactoring / simplifying the calculation of thumbnail widths and heights.

Given there is no team actively maintaining and building out MMV right now, I would personally recommend working towards an approach where we would do:

  • 1 on the short term (but avoid if possible)
  • 2 on the medium term (through refactoring existing code paths)
  • 3 on the long term

Thoughts?

Change #1080832 merged by jenkins-bot:

[mediawiki/extensions/SearchVue@master] mmv.bootstrap.autostart module was deprecated

https://gerrit.wikimedia.org/r/1080832

@simon04 would you be able to post a patch to remove mmv.bootstrap.autostart and mmv.head module ? If not, no worries, I can post that next week when I'm back from vacation and find someone to review :-).

Change #1098146 had a related patch set uploaded (by Simon04; author: Simon04):

[mediawiki/extensions/MultimediaViewer@master] Remove deprecated mmv.bootstrap.autostart and mmv.head

https://gerrit.wikimedia.org/r/1098146

Change #1098146 merged by jenkins-bot:

[mediawiki/extensions/MultimediaViewer@master] Remove deprecated mmv.bootstrap.autostart and mmv.head

https://gerrit.wikimedia.org/r/1098146