Page MenuHomePhabricator

Video.js player doesn’t work with Score
Closed, ResolvedPublicBUG REPORT

Description

Steps to Reproduce:

Actual Results:

Expected Results:

  • The autogenerated audio plays. It was so earlier even with the Video.js beta feature.

Event Timeline

Reedy renamed this task from [Regression] Video.js player doesn’t work with Score to Video.js player doesn’t work with Score.Feb 17 2020, 12:38 AM
Reedy added a project: Regression.
brooke subscribed.

Grabbing a couple high-prio TMH issues to work on the next week or two. Looks like a bug in the surrounding JS that assumes some things are marked up in one way but they aren't for Score stuff.

I think this is happening again on some pages on testwiki where the fix for T257066 is under test, e.g. Category:Musical pages and Frankenstein II.. Happens in both Firefox and chromium-browser. What's puzzling is it doesn't happen on all pages using Score, and I can copy the <score> content to another page and sometimes it renders fine. Heisenbug! And on a page that's messed up, a File:somefile.mid TMH player will also appear wrong.

Sometimes there's a flash of the proper player, then it goes gray and featureless. Maybe something is setting a disabled attribute.

Screenshot_20210712_230941.png (175×800 px, 12 KB)

FWIW my browser console also reports "Exception in module-execute in module ext.gadget.Twinkle" (even browsing anonymously and so not? using Twinkle).

Also happening on plwikisource. Here we have two built-in players: one originating from a simple [[File:audio.mp3]] transclusion (contained in the infobox), another one introduced by the musical score. Apparently they interfere with each other if present on the same page, but having either of them alone is fine. Remarks (tested on Firefox/Win10):

  • I can successfully reproduce the File-based player, this action opens a pop-up window. If I click then on the score-based player, I'm redirected to File:Undefined.
  • Conversely, if I attempt to play the score-based track first, nothing happens and I get the "TypeError: title is undefined" on console. The File-based player is unresponsive from that point on.

I am having the same problem on a wiki that I manage. I have the TimedMediaPlayer, EmbedVideo, and Score extensions installed. When trying to play the midi file generated from a <score> tag, I start to see the loading bar at the top of the page, which then disappears and no media is played. For example with this wiki markup:

<score sound="1">\relative c'' { \time 4/4 \key c \major c4 g8 g a4 g r b^> c^> r \bar "|." } \addlyrics { Shave and a hair -- cut: two bits. }</score>

I see this in the Chrome console:

TypeError: Cannot read property 'replace' of undefined
    at parse (<anonymous>:396:810)
    at new Title (<anonymous>:398:501)
    at Object.<anonymous> (<anonymous>:3:166)
    at Function.jQuery.Deferred (load.php?lang=en&modules=jquery%2Coojs-ui-core&skin=vector&version=mzne3:155)
    at jQuery.fn.init.showVideoPlayerDialog (<anonymous>:2:843)
    at <anonymous>:326:630
    at fire (load.php?lang=en&modules=jquery%2Coojs-ui-core&skin=vector&version=mzne3:46)
    at Object.fireWith [as resolveWith] (load.php?lang=en&modules=jquery%2Coojs-ui-core&skin=vector&version=mzne3:47)
    at Object.deferred.<computed> [as resolve] (load.php?lang=en&modules=jquery%2Coojs-ui-core&skin=vector&version=mzne3:50)
    at Object.ready (<anonymous>:422:734)

This happens when a page has a Score and also a TMH element. The TMH player script tries to load it's JS on top of the Score player, but we probably never tested that in the last couple of years (because everything was broken).

I'm guessing it's a problem with the Score extension, because in the generated HTML markup, I'm seeing an anchor with File:Undefined:

<div class="mw-ext-score" data-midi="/w/images/lilypond/m/s/ms681teziv1i6q58pc9g08av66tfv20/ms681tez.midi">
  <img src="/w/images/lilypond/m/s/ms681teziv1i6q58pc9g08av66tfv20/ms681tez.png" width="333" height="67" alt="\relative c'' { \time 4/4 \key c \major c4 g8 g a4 g r b^> c^> r \bar &quot;|.&quot; } \addlyrics { Shave and a hair -- cut: two bits. }">
  <span class="mw-tmh-player audio">
    <audio id="mwe_player_0" preload="none" width="300" data-disablecontrols="options,timedText" data-durationhint="4.8324375" disabled="disabled">
      <source src="/w/images/lilypond/m/s/ms681teziv1i6q58pc9g08av66tfv20/ms681tez.mp3" type="audio/mpeg">
    </audio>
    <a class="mw-tmh-play" href="/wiki/File:Undefined" title="Play media"></a>
  </span>
</div>

Sometimes when loading the page with debugging turned on, I see an error along the lines of "Cannot load File:Undefined".

I see that the error is no longer occurring on the first page referred to in the Description (https://hu.wikipedia.org/wiki/Bevettek_husz%C3%A1rnak). How was this fixed?

I also notice that if I add "?debug=1" to the page of my own wiki, I get a normal working midi player for a short while, which gives a bit of time to play the midi file. Once it has played, or anyways after a short while, the player becomes a non-working TMH player. And without "?debug=1" I get a non-working TMH player. Page is https://en.seminaverbi.bibleget.io/wiki/User:Johnrdorazio?debug=1 .

I'm guessing it's a problem with the Score extension, because in the generated HTML markup, I'm seeing an anchor with File:Undefined:

<div class="mw-ext-score" data-midi="/w/images/lilypond/m/s/ms681teziv1i6q58pc9g08av66tfv20/ms681tez.midi">
  <img src="/w/images/lilypond/m/s/ms681teziv1i6q58pc9g08av66tfv20/ms681tez.png" width="333" height="67" alt="\relative c'' { \time 4/4 \key c \major c4 g8 g a4 g r b^> c^> r \bar &quot;|.&quot; } \addlyrics { Shave and a hair -- cut: two bits. }">
  <span class="mw-tmh-player audio">
    <audio id="mwe_player_0" preload="none" width="300" data-disablecontrols="options,timedText" data-durationhint="4.8324375" disabled="disabled">
      <source src="/w/images/lilypond/m/s/ms681teziv1i6q58pc9g08av66tfv20/ms681tez.mp3" type="audio/mpeg">
    </audio>
    <a class="mw-tmh-play" href="/wiki/File:Undefined" title="Play media"></a>
  </span>
</div>

Sometimes when loading the page with debugging turned on, I see an error along the lines of "Cannot load File:Undefined".

No. Why would Score add an HTML element with class mw-tmh-play? tmh stands for TimedMediaHandler. I’m pretty sure it’s TMH’s JavaScript module, which gets loaded when there are non-Score videos/audio files on the page, but tries to process the Score player (and fails).

I see that the error is no longer occurring on the first page referred to in the Description (https://hu.wikipedia.org/wiki/Bevettek_husz%C3%A1rnak). How was this fixed?

It looks like now TMH’s JavaScript is loaded only when there are non-Score videos/audio files on the page. Since this article doesn’t contain such, the buggy JS is not loaded in the first place.

I also notice that if I add "?debug=1" to the page of my own wiki, I get a normal working midi player for a short while, which gives a bit of time to play the midi file. Once it has played, or anyways after a short while, the player becomes a non-working TMH player. And without "?debug=1" I get a non-working TMH player. Page is https://en.seminaverbi.bibleget.io/wiki/User:Johnrdorazio?debug=1 .

It takes some time to load the buggy JavaScript; in debug mode more than in non-debug mode. Probably the working player appears in non-debug mode as well, just for a so short time that you don’t even notice it (let alone starting it). By the way, your wiki uses a one-year-old version of the extension, which is not terrible per se, but makes it totally unsuitable for debugging and testing.

My guess now is that TimedMediaHandler looks for a file with an article in the File namespace, but the Score extension is using a path such as

/w/images/lilypond/5/3/53m5hz6lsx5goei3o98b86w8bb3cr33/53m5hz6l.mp3

which is not in the File namespace?

With TimedMediaHandler enabled, the output of the Score tag is:

<div style="margin-top: 3px;"><span class="mw-tmh-player audio"><audio disabled="disabled"><source src="/w/images/lilypond/5/3/53m5hz6lsx5goei3o98b86w8bb3cr33/53m5hz6l.mp3" type="audio/mpeg">
<div>Audio playback is not supported in your browser. You can <a href="/w/images/lilypond/5/3/53m5hz6lsx5goei3o98b86w8bb3cr33/53m5hz6l.mp3">download the audio file</a>.</div></audio><a class="mw-tmh-play" href="/wiki/File:Undefined" title="Play media"></a></span></div>

Whereas the output of a [[File:Twelve bar boogie-woogie blues in C.mid]] is:

<span class="mw-tmh-player audio"><audio id="mwe_player_0" preload="none" width="300" data-durationhint="27.0009765625" data-startoffset="0" data-mwtitle="Twelve_bar_boogie-woogie_blues_in_C.mid" data-mwprovider="enwiki" disabled="disabled"><source src="https://upload.wikimedia.org/wikipedia/commons/transcoded/d/da/Twelve_bar_boogie-woogie_blues_in_C.mid/Twelve_bar_boogie-woogie_blues_in_C.mid.mp3" type="audio/mpeg" data-title="MP3" data-shorttitle="MP3" data-transcodekey="mp3" data-width="0" data-height="0" data-bandwidth="0"><source src="https://upload.wikimedia.org/wikipedia/commons/transcoded/d/da/Twelve_bar_boogie-woogie_blues_in_C.mid/Twelve_bar_boogie-woogie_blues_in_C.mid.ogg" type="audio/ogg; codecs=&quot;vorbis&quot;" data-title="Ogg Vorbis" data-shorttitle="Ogg Vorbis" data-transcodekey="ogg" data-width="0" data-height="0" data-bandwidth="0"><source src="https://upload.wikimedia.org/wikipedia/commons/d/da/Twelve_bar_boogie-woogie_blues_in_C.mid" type="audio/midi" data-title="Original ⧼timedmedia-midi⧽ file (283 bps)" data-shorttitle="⧼timedmedia-midi⧽ source" data-width="0" data-height="0" data-bandwidth="283"></audio><a class="mw-tmh-play" href="/wiki/File:Twelve_bar_boogie-woogie_blues_in_C.mid" title="Play media"></a></span>

For the time being, I have found that setting the web player to the Kaltura player will work in all situations:

$wgTmhWebPlayer = "mwembed";

At least it will get the autogenerated midi / mp3 file to play. Clicking on "MENU" will show an eternal spinning loader, probably because the Kaltura player can't get any information from the File namespace.

Perhaps the Score extension should generate an article in the File namespace corresponding with the autogenerated midi / mp3?

Perhaps the Score extension should generate an article in the File namespace corresponding with the autogenerated midi / mp3?

Actually generating pages in the File namespace would mean that whenever a score is changed, an edit is made in the File namespace—even if this score change is never saved, just previewed. No, this shouldn’t be done. Maybe we could do as if the edit was made, but since TMH depends on the internals of MediaWiki, anything unusual (like not saving the generated file description page in the database) lowers the likelihood of the bug being worked around by this method.

Been more than a year.

In T245377#5984919, @brion wrote:

Grabbing a couple high-prio TMH issues to work on the next week or two. Looks like a bug in the surrounding JS that assumes some things are marked up in one way but they aren't for Score stuff.

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

[mediawiki/extensions/TimedMediaHandler@master] Make dialog not crash on missing title

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

Change 740942 merged by jenkins-bot:

[mediawiki/extensions/TimedMediaHandler@master] Make dialog not crash on missing title

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

TheDJ claimed this task.